Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove unused prop from BottomSheetModal component #299

Merged
merged 1 commit into from
Apr 29, 2024
Merged
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
28 changes: 12 additions & 16 deletions src/frontend/sharedComponents/BottomSheetModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,27 +73,13 @@ interface Props extends React.PropsWithChildren<{}> {
onDismiss?: () => void;
// Triggered by: Android hardware back press and gesture back swipe
onBack?: () => void;
disableBackrop?: boolean;
fullHeight?: boolean;
}

export const BottomSheetModal = React.forwardRef<RNBottomSheetModal, Props>(
({children, isOpen, onBack, disableBackrop, fullHeight}, ref) => {
({children, isOpen, onBack, fullHeight}, ref) => {
useBackHandler(isOpen, onBack);

const renderBackdrop = React.useCallback(
(props: BottomSheetBackdropProps) => {
return (
<BottomSheetBackdrop
{...props}
pressBehavior="none"
disappearsOnIndex={-1}
/>
);
},
[],
);

return (
<RNBottomSheetModal
ref={ref}
Expand All @@ -102,7 +88,7 @@ export const BottomSheetModal = React.forwardRef<RNBottomSheetModal, Props>(
? {borderRadius: 0}
: {borderColor: DARK_GREY, borderWidth: 1},
]}
backdropComponent={disableBackrop ? null : renderBackdrop}
backdropComponent={DefaultBackdrop}
enableContentPanningGesture={false}
enableHandlePanningGesture={false}
snapPoints={!fullHeight ? undefined : ['100%']}
Expand All @@ -114,4 +100,14 @@ export const BottomSheetModal = React.forwardRef<RNBottomSheetModal, Props>(
},
);

function DefaultBackdrop(props: BottomSheetBackdropProps) {
return (
<BottomSheetBackdrop
{...props}
pressBehavior="none"
disappearsOnIndex={-1}
/>
);
}

export {BottomSheetContent} from '../BottomSheet';
Loading