Handle close & backdrop dismissal for Explore bottom sheet; closes #1075 (#1098)

This commit is contained in:
Amanda Bullington
2024-01-30 16:54:58 -08:00
committed by GitHub
parent 93061bf8de
commit f770304de8
6 changed files with 24 additions and 36 deletions

View File

@@ -184,21 +184,23 @@ const Explore = ( {
/>
</ViewWrapper>
)}
{showExploreBottomSheet && (
<BottomSheet headerText={t( "EXPLORE" )}>
{Object.keys( exploreViewText ).map( view => (
<Button
text={exploreViewText[view]}
key={exploreViewText[view]}
className="mx-5 my-3"
onPress={() => {
changeExploreView( view );
setShowExploreBottomSheet( false );
}}
/>
) )}
</BottomSheet>
)}
<BottomSheet
handleClose={( ) => setShowExploreBottomSheet( false )}
headerText={t( "EXPLORE" )}
hidden={!showExploreBottomSheet}
>
{Object.keys( exploreViewText ).map( view => (
<Button
className="mx-5 my-3"
key={exploreViewText[view]}
onPress={() => {
changeExploreView( view );
setShowExploreBottomSheet( false );
}}
text={exploreViewText[view]}
/>
) )}
</BottomSheet>
</>
);
};

View File

@@ -59,6 +59,12 @@ const StandardBottomSheet = ( {
// eslint-disable-next-line
const noHandle = ( ) => <></>;
const handleBackdropPress = useCallback( position => {
if ( handleClose && position === -1 ) {
handleClose( );
}
}, [handleClose] );
const handleClosePress = useCallback( ( ) => {
if ( handleClose ) {
handleClose( );
@@ -100,7 +106,7 @@ const StandardBottomSheet = ( {
style={viewStyles.shadow}
handleComponent={noHandle}
backdropComponent={renderBackdrop}
onChange={onChange}
onChange={onChange || handleBackdropPress}
>
<BottomSheetView onLayout={handleContentLayout}>
<View className="items-center">

View File

@@ -43,11 +43,6 @@ const RadioButtonSheet = ( {
<BottomSheet
handleClose={handleClose}
headerText={headerText}
onChange={position => {
if ( position === -1 ) {
handleClose( );
}
}}
>
<View className="p-5">
{Object.keys( radioValues ).map( radioRow => radioButtonRow( radioRow ) )}

View File

@@ -53,11 +53,6 @@ const TextInputSheet = ( {
<BottomSheet
handleClose={handleClose}
headerText={headerText}
onChange={position => {
if ( position === -1 ) {
handleClose();
}
}}
>
<View className="p-5">
<BottomSheetTextInput

View File

@@ -31,11 +31,6 @@ const TextSheet = ( {
handleClose={handleClose}
headerText={headerText}
hideCloseButton
onChange={position => {
if ( position === -1 ) {
handleClose( );
}
}}
>
<View className="p-5">
<Body3 className="pb-5">

View File

@@ -37,11 +37,6 @@ const WarningSheet = ( {
headerText={headerText}
hidden={hidden}
insideModal={insideModal}
onChange={position => {
if ( position === -1 ) {
handleClose( );
}
}}
>
<View className="items-center p-5">
{text && <List2 className="mb-6">{text}</List2>}