Page MenuHomePhabricator

D8981.diff
No OneTemporary

D8981.diff

diff --git a/native/bottom-sheets/bottom-sheet-backdrop.react.js b/native/bottom-sheets/bottom-sheet-backdrop.react.js
new file mode 100644
--- /dev/null
+++ b/native/bottom-sheets/bottom-sheet-backdrop.react.js
@@ -0,0 +1,40 @@
+// @flow
+
+import { BottomSheetBackdrop as Backdrop } from '@gorhom/bottom-sheet';
+import * as React from 'react';
+import type { SharedValue } from 'react-native-reanimated';
+
+type BackdropPressBehavior = 'none' | 'close' | 'collapse';
+
+type Props = {
+ +animatedIndex: SharedValue<number>,
+ +animatedPosition: SharedValue<number>,
+ +opacity?: number,
+ +appearsOnIndex?: number,
+ +disappearsOnIndex?: number,
+ +enableTouchThrough?: boolean,
+ +pressBehavior?: BackdropPressBehavior | number,
+};
+
+function BottomSheetBackdrop(props: Props): React.Node {
+ const {
+ opacity,
+ appearsOnIndex,
+ disappearsOnIndex,
+ enableTouchThrough,
+ pressBehavior,
+ } = props;
+
+ return (
+ <Backdrop
+ {...props}
+ opacity={opacity ?? 0.5}
+ appearsOnIndex={appearsOnIndex ?? 0}
+ disappearsOnIndex={disappearsOnIndex ?? -1}
+ enableTouchThrough={enableTouchThrough ?? false}
+ pressBehavior={pressBehavior ?? 'close'}
+ />
+ );
+}
+
+export default BottomSheetBackdrop;
diff --git a/native/bottom-sheets/bottom-sheet.react.js b/native/bottom-sheets/bottom-sheet.react.js
--- a/native/bottom-sheets/bottom-sheet.react.js
+++ b/native/bottom-sheets/bottom-sheet.react.js
@@ -3,6 +3,7 @@
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';
@@ -26,6 +27,7 @@
backgroundStyle={styles.background}
snapPoints={snapPoints}
handleComponent={BottomSheetHandle}
+ backdropComponent={BottomSheetBackdrop}
>
{children}
</BottomSheetModal>

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 9, 8:51 AM (20 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2451032
Default Alt Text
D8981.diff (1 KB)

Event Timeline