Skip to content

Commit ec7ebc6

Browse files
fix(pure-black): migrate confirmation Expandable to MMDS BottomSheet
The Advanced details bottom sheet (and other confirmation expandable sections) used the legacy BottomModal with a hardcoded bg-section background. In Pure Black theme this caused a contrast mismatch against the surrounding page. Replace BottomModal with MMDS BottomSheet, which applies bg-alternative automatically in Pure Black mode. Fixes TMCU-1059 (part of TMCU-622) Co-authored-by: George Marshall <georgewrmarshall@users.noreply.github.com>
1 parent 480b6e4 commit ec7ebc6

3 files changed

Lines changed: 43 additions & 30 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Fixed
11+
12+
- Fixed Advanced details bottom sheet background in Pure Black theme by migrating confirmation expandable sheets to MMDS BottomSheet (#TBD)
1013
## [8.1.1]
1114

1215
### Fixed

app/components/Views/confirmations/components/UI/expandable/expandable.styles.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,8 @@ const styleSheet = (params: {
2020
padding: isCompact ? 0 : 16,
2121
marginBottom: isCompact ? 0 : 8,
2222
},
23-
modalContent: {
24-
backgroundColor: theme.colors.background.section,
25-
paddingBottom: 34,
26-
borderTopLeftRadius: 8,
27-
borderTopRightRadius: 8,
28-
},
2923
modalExpandedContent: {
24+
paddingBottom: 34,
3025
paddingHorizontal: 16,
3126
},
3227
copyButtonContainer: {

app/components/Views/confirmations/components/UI/expandable/expandable.tsx

Lines changed: 39 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
import React, { ReactNode, useState } from 'react';
2-
import { HeaderStandard } from '@metamask/design-system-react-native';
3-
import { TouchableOpacity, View } from 'react-native';
1+
import React, { ReactNode, useCallback, useRef, useState } from 'react';
2+
import {
3+
BottomSheet,
4+
BottomSheetRef,
5+
HeaderStandard,
6+
} from '@metamask/design-system-react-native';
7+
import { Modal, TouchableOpacity, View } from 'react-native';
48

59
import { useStyles } from '../../../../../../component-library/hooks';
6-
import BottomModal from '../bottom-modal';
710
import CopyButton from '../copy-button';
811
import styleSheet from './expandable.styles';
912

@@ -32,6 +35,15 @@ const Expandable = ({
3235
}: ExpandableProps) => {
3336
const { styles } = useStyles(styleSheet, { isCompact });
3437
const [expanded, setExpanded] = useState(false);
38+
const bottomSheetRef = useRef<BottomSheetRef>(null);
39+
40+
const closeExpanded = useCallback(() => {
41+
bottomSheetRef.current?.onCloseBottomSheet();
42+
}, []);
43+
44+
const handleSheetClosed = useCallback(() => {
45+
setExpanded(false);
46+
}, []);
3547

3648
return (
3749
<>
@@ -45,27 +57,30 @@ const Expandable = ({
4557
>
4658
{collapsedContent}
4759
</TouchableOpacity>
48-
{expanded && (
49-
<BottomModal onClose={() => setExpanded(false)}>
50-
<View style={styles.modalContent}>
51-
<HeaderStandard
52-
title={expandedContentTitle}
53-
onClose={() => setExpanded(false)}
54-
closeButtonProps={{
55-
testID: collapseButtonTestID ?? 'collapseButtonTestID',
56-
}}
57-
/>
58-
<View style={styles.modalExpandedContent}>
59-
{copyText && (
60-
<View style={styles.copyButtonContainer}>
61-
<CopyButton copyText={copyText} />
62-
</View>
63-
)}
64-
{expandedContent}
65-
</View>
60+
<Modal
61+
visible={expanded}
62+
transparent
63+
animationType="none"
64+
onRequestClose={closeExpanded}
65+
>
66+
<BottomSheet ref={bottomSheetRef} onClose={handleSheetClosed}>
67+
<HeaderStandard
68+
title={expandedContentTitle}
69+
onClose={closeExpanded}
70+
closeButtonProps={{
71+
testID: collapseButtonTestID ?? 'collapseButtonTestID',
72+
}}
73+
/>
74+
<View style={styles.modalExpandedContent}>
75+
{copyText && (
76+
<View style={styles.copyButtonContainer}>
77+
<CopyButton copyText={copyText} />
78+
</View>
79+
)}
80+
{expandedContent}
6681
</View>
67-
</BottomModal>
68-
)}
82+
</BottomSheet>
83+
</Modal>
6984
</>
7085
);
7186
};

0 commit comments

Comments
 (0)