Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.

Commit c444a46

Browse files
author
Jonathan Canevese
committed
feat!: pressableBackdrop
1 parent 0a1e43d commit c444a46

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

src/components/BottomModal.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { StyleSheet, View, ViewStyle } from 'react-native';
77
import {
88
PanGestureHandler,
99
PanGestureHandlerGestureEvent,
10+
TouchableWithoutFeedback,
1011
} from 'react-native-gesture-handler';
1112
import Animated, {
1213
Easing,
@@ -18,6 +19,10 @@ import Animated, {
1819
withSpring,
1920
withTiming,
2021
} from 'react-native-reanimated';
22+
const ReanimatedBackdrop = Animated.createAnimatedComponent(
23+
TouchableWithoutFeedback
24+
);
25+
2126
import { screen } from '../utils';
2227

2328
export type BottomModalProps = {
@@ -62,6 +67,10 @@ export type BottomModalProps = {
6267
* Style of backdrop component
6368
*/
6469
backdropStyle?: ViewStyle;
70+
/**
71+
* Action when pressing backdrop component
72+
*/
73+
onPressBackdrop?: () => {};
6574
};
6675

6776
export type BottomModalRef = {
@@ -92,6 +101,7 @@ const BottomModal = React.forwardRef<
92101
style,
93102
children,
94103
backdropStyle,
104+
onPressBackdrop,
95105
animation,
96106
springConfig,
97107
timingConfig,
@@ -171,7 +181,8 @@ const BottomModal = React.forwardRef<
171181

172182
return (
173183
<View style={styles.fullScreen}>
174-
<Animated.View
184+
<ReanimatedBackdrop
185+
onPress={onPressBackdrop}
175186
style={[
176187
styles.backdrop,
177188
{ backgroundColor: backdropColor },

0 commit comments

Comments
 (0)