Skip to content

Commit d7dd057

Browse files
committed
extracted host gesture detector
1 parent 9c30c1a commit d7dd057

File tree

4 files changed

+12
-75
lines changed

4 files changed

+12
-75
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import RNGestureHandlerDetectorNativeComponent from '../specs/RNGestureHandlerDetectorNativeComponent';
2+
const HostGestureDetector = RNGestureHandlerDetectorNativeComponent;
3+
export default HostGestureDetector;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import GestureHandlerDetector from '../web/GestureHandlerDetector';
2+
const HostGestureDetector = GestureHandlerDetector;
3+
export default HostGestureDetector;

packages/react-native-gesture-handler/src/v3/NativeDetector.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,26 @@ import { NativeGesture } from './hooks/useGesture';
33
import { Reanimated } from '../handlers/gestures/reanimatedWrapper';
44

55
import { Animated, StyleSheet } from 'react-native';
6-
import RNGestureHandlerDetectorNativeComponent from '../specs/RNGestureHandlerDetectorNativeComponent';
6+
import HostGestureDetector from './HostGestureDetector';
77
import { tagMessage } from '../utils';
88

99
export interface NativeDetectorProps {
1010
children?: React.ReactNode;
1111
gesture: NativeGesture;
1212
}
1313

14-
const AnimatedNativeDetector = Animated.createAnimatedComponent(
15-
RNGestureHandlerDetectorNativeComponent
16-
);
14+
const AnimatedNativeDetector =
15+
Animated.createAnimatedComponent(HostGestureDetector);
1716

18-
const ReanimatedNativeDetector = Reanimated?.default.createAnimatedComponent(
19-
RNGestureHandlerDetectorNativeComponent
20-
);
17+
const ReanimatedNativeDetector =
18+
Reanimated?.default.createAnimatedComponent(HostGestureDetector);
2119

2220
export function NativeDetector({ gesture, children }: NativeDetectorProps) {
2321
const NativeDetectorComponent = gesture.dispatchesAnimatedEvents
2422
? AnimatedNativeDetector
2523
: gesture.shouldUseReanimated
2624
? ReanimatedNativeDetector
27-
: RNGestureHandlerDetectorNativeComponent;
25+
: HostGestureDetector;
2826

2927
// It might happen only with ReanimatedNativeDetector
3028
if (!NativeDetectorComponent) {

packages/react-native-gesture-handler/src/v3/NativeDetector.web.tsx

Lines changed: 0 additions & 67 deletions
This file was deleted.

0 commit comments

Comments
 (0)