Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- Fixed Advanced details bottom sheet background in Pure Black theme by migrating confirmation expandable sheets to MMDS BottomSheet (#33160)
## [8.1.1]

### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,8 @@ const styleSheet = (params: {
padding: isCompact ? 0 : 16,
marginBottom: isCompact ? 0 : 8,
},
modalContent: {
backgroundColor: theme.colors.background.section,
paddingBottom: 34,
borderTopLeftRadius: 8,
borderTopRightRadius: 8,
},
modalExpandedContent: {
paddingBottom: 34,
paddingHorizontal: 16,
},
copyButtonContainer: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import React, { ReactNode, useState } from 'react';
import { HeaderStandard } from '@metamask/design-system-react-native';
import { TouchableOpacity, View } from 'react-native';
import React, { ReactNode, useCallback, useRef, useState } from 'react';
import {
BottomSheet,
BottomSheetRef,
HeaderStandard,
} from '@metamask/design-system-react-native';
import { Modal, TouchableOpacity, View } from 'react-native';

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

Expand Down Expand Up @@ -32,6 +35,15 @@ const Expandable = ({
}: ExpandableProps) => {
const { styles } = useStyles(styleSheet, { isCompact });
const [expanded, setExpanded] = useState(false);
const bottomSheetRef = useRef<BottomSheetRef>(null);

const closeExpanded = useCallback(() => {
bottomSheetRef.current?.onCloseBottomSheet();
}, []);

const handleSheetClosed = useCallback(() => {
setExpanded(false);
}, []);

return (
<>
Expand All @@ -45,27 +57,30 @@ const Expandable = ({
>
{collapsedContent}
</TouchableOpacity>
{expanded && (
<BottomModal onClose={() => setExpanded(false)}>
<View style={styles.modalContent}>
<HeaderStandard
title={expandedContentTitle}
onClose={() => setExpanded(false)}
closeButtonProps={{
testID: collapseButtonTestID ?? 'collapseButtonTestID',
}}
/>
<View style={styles.modalExpandedContent}>
{copyText && (
<View style={styles.copyButtonContainer}>
<CopyButton copyText={copyText} />
</View>
)}
{expandedContent}
</View>
<Modal
visible={expanded}
transparent
animationType="none"
onRequestClose={closeExpanded}
>
<BottomSheet ref={bottomSheetRef} onClose={handleSheetClosed}>
<HeaderStandard
title={expandedContentTitle}
onClose={closeExpanded}
closeButtonProps={{
testID: collapseButtonTestID ?? 'collapseButtonTestID',
}}
/>
<View style={styles.modalExpandedContent}>
{copyText && (
<View style={styles.copyButtonContainer}>
<CopyButton copyText={copyText} />
</View>
)}
{expandedContent}
</View>
</BottomModal>
)}
</BottomSheet>
</Modal>
</>
);
};
Expand Down
Loading