@@ -9,16 +9,12 @@ import React, {
9
9
import { ViewProps } from 'react-native' ;
10
10
import Animated , {
11
11
interpolate ,
12
- Extrapolate ,
13
12
useAnimatedStyle ,
14
13
useAnimatedReaction ,
15
- useAnimatedGestureHandler ,
16
14
runOnJS ,
15
+ Extrapolation ,
17
16
} from 'react-native-reanimated' ;
18
- import {
19
- TapGestureHandler ,
20
- TapGestureHandlerGestureEvent ,
21
- } from 'react-native-gesture-handler' ;
17
+ import { Gesture , GestureDetector } from 'react-native-gesture-handler' ;
22
18
import { useBottomSheet } from '../../hooks' ;
23
19
import {
24
20
DEFAULT_OPACITY ,
@@ -91,15 +87,12 @@ const BottomSheetBackdropComponent = ({
91
87
//#endregion
92
88
93
89
//#region tap gesture
94
- const gestureHandler =
95
- useAnimatedGestureHandler < TapGestureHandlerGestureEvent > (
96
- {
97
- onFinish : ( ) => {
98
- runOnJS ( handleOnPress ) ( ) ;
99
- } ,
100
- } ,
101
- [ handleOnPress ]
102
- ) ;
90
+ const tapHandler = useMemo ( ( ) => {
91
+ let gesture = Gesture . Tap ( ) . onEnd ( ( ) => {
92
+ runOnJS ( handleOnPress ) ( ) ;
93
+ } ) ;
94
+ return gesture ;
95
+ } , [ handleOnPress ] ) ;
103
96
//#endregion
104
97
105
98
//#region styles
@@ -108,7 +101,7 @@ const BottomSheetBackdropComponent = ({
108
101
animatedIndex . value ,
109
102
[ - 1 , disappearsOnIndex , appearsOnIndex ] ,
110
103
[ 0 , 0 , opacity ] ,
111
- Extrapolate . CLAMP
104
+ Extrapolation . CLAMP
112
105
) ,
113
106
flex : 1 ,
114
107
} ) ) ;
@@ -160,9 +153,7 @@ const BottomSheetBackdropComponent = ({
160
153
) ;
161
154
162
155
return pressBehavior !== 'none' ? (
163
- < TapGestureHandler onGestureEvent = { gestureHandler } >
164
- { AnimatedView }
165
- </ TapGestureHandler >
156
+ < GestureDetector gesture = { tapHandler } > { AnimatedView } </ GestureDetector >
166
157
) : (
167
158
AnimatedView
168
159
) ;
0 commit comments