diff --git a/native/bottom-sheet/bottom-sheet.react.js b/native/bottom-sheet/bottom-sheet.react.js --- a/native/bottom-sheet/bottom-sheet.react.js +++ b/native/bottom-sheet/bottom-sheet.react.js @@ -1,6 +1,6 @@ // @flow -import { BottomSheetModal } from '@gorhom/bottom-sheet'; +import { default as GorhomBottomSheet } from '@gorhom/bottom-sheet'; import invariant from 'invariant'; import * as React from 'react'; @@ -16,7 +16,7 @@ function ForwardedBottomSheet( props: Props, - ref: React.Ref, + ref: React.Ref, ): React.Node { const { children, onClosed } = props; @@ -29,17 +29,27 @@ const snapPoints = React.useMemo(() => [contentHeight], [contentHeight]); + const onChange = React.useCallback( + (index: number) => { + if (index === -1) { + onClosed(); + } + }, + [onClosed], + ); + return ( - {children} - + ); } @@ -51,15 +61,15 @@ const BottomSheet: React.AbstractComponent< Props, - React.ElementRef, -> = React.forwardRef>( + React.ElementRef, +> = React.forwardRef>( ForwardedBottomSheet, ); BottomSheet.displayName = 'BottomSheet'; const MemoizedBottomSheet: typeof BottomSheet = React.memo< Props, - React.ElementRef, + React.ElementRef, >(BottomSheet); export default MemoizedBottomSheet; diff --git a/native/user-profile/user-profile-bottom-sheet.react.js b/native/user-profile/user-profile-bottom-sheet.react.js --- a/native/user-profile/user-profile-bottom-sheet.react.js +++ b/native/user-profile/user-profile-bottom-sheet.react.js @@ -35,14 +35,6 @@ const bottomSheetRef = React.useRef(); - React.useEffect(() => { - if (!bottomSheetRef.current) { - return; - } - - bottomSheetRef.current.present(); - }, []); - const onClosed = React.useCallback(() => { goBackOnce(); }, [goBackOnce]);