Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3509344
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/native/bottom-sheets/bottom-sheet.react.js b/native/bottom-sheets/bottom-sheet.react.js
index 84d1e62ed..f86c2af49 100644
--- a/native/bottom-sheets/bottom-sheet.react.js
+++ b/native/bottom-sheets/bottom-sheet.react.js
@@ -1,56 +1,67 @@
// @flow
import { BottomSheetModal } from '@gorhom/bottom-sheet';
import * as React from 'react';
import BottomSheetBackdrop from './bottom-sheet-backdrop.react.js';
import BottomSheetHandle from './bottom-sheet-handle.react.js';
import { useStyles } from '../themes/colors.js';
type Props = {
+children: React.Node,
+ +onClosed: () => mixed,
};
function ForwardedBottomSheet(
props: Props,
ref: React.Ref<typeof BottomSheetModal>,
): React.Node {
- const { children } = props;
+ const { children, onClosed } = props;
const styles = useStyles(unboundStyles);
const snapPoints = React.useMemo(() => ['25%', '50%'], []);
+ const onChange = React.useCallback(
+ (index: number) => {
+ if (index === -1) {
+ onClosed();
+ }
+ },
+ [onClosed],
+ );
+
return (
<BottomSheetModal
ref={ref}
backgroundStyle={styles.background}
snapPoints={snapPoints}
handleComponent={BottomSheetHandle}
backdropComponent={BottomSheetBackdrop}
+ onChange={onChange}
>
{children}
</BottomSheetModal>
);
}
const unboundStyles = {
background: {
backgroundColor: 'modalForeground',
},
};
const BottomSheet: React.AbstractComponent<
Props,
React.ElementRef<typeof BottomSheetModal>,
> = React.forwardRef<Props, React.ElementRef<typeof BottomSheetModal>>(
ForwardedBottomSheet,
);
BottomSheet.displayName = 'BottomSheet';
const MemoizedBottomSheet: typeof BottomSheet = React.memo<
Props,
React.ElementRef<typeof BottomSheetModal>,
>(BottomSheet);
export default MemoizedBottomSheet;
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Mon, Dec 23, 3:41 AM (16 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2690303
Default Alt Text
(1 KB)
Attached To
Mode
rCOMM Comm
Attached
Detach File
Event Timeline
Log In to Comment