|
1 | 1 | /* eslint-disable react/no-unused-prop-types */ |
2 | | -import React, { useContext, useEffect, useMemo, useRef } from 'react'; |
3 | | -import { Platform } from 'react-native'; |
| 2 | +import React, { useEffect, useMemo, useRef } from 'react'; |
4 | 3 | import findNodeHandle from '../../../findNodeHandle'; |
5 | 4 | import { GestureType } from '../gesture'; |
6 | 5 | import { UserSelect, TouchAction } from '../../gestureHandlerCommon'; |
7 | 6 | import { ComposedGesture } from '../gestureComposition'; |
8 | | -import { isTestEnv } from '../../../utils'; |
9 | | - |
10 | | -import GestureHandlerRootViewContext from '../../../GestureHandlerRootViewContext'; |
11 | 7 | import { AttachedGestureState, GestureDetectorState } from './types'; |
12 | 8 | import { useAnimatedGesture } from './useAnimatedGesture'; |
13 | 9 | import { attachHandlers } from './attachHandlers'; |
@@ -87,13 +83,6 @@ export interface GestureDetectorProps { |
87 | 83 | * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/gesture-detector |
88 | 84 | */ |
89 | 85 | export const GestureDetector = (props: GestureDetectorProps) => { |
90 | | - const rootViewContext = useContext(GestureHandlerRootViewContext); |
91 | | - if (__DEV__ && !rootViewContext && !isTestEnv() && Platform.OS !== 'web') { |
92 | | - throw new Error( |
93 | | - 'GestureDetector must be used as a descendant of GestureHandlerRootView. Otherwise the gestures will not be recognized. See https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/installation for more details.' |
94 | | - ); |
95 | | - } |
96 | | - |
97 | 86 | // Gesture config should be wrapped with useMemo to prevent unnecessary re-renders |
98 | 87 | const gestureConfig = props.gesture; |
99 | 88 | propagateDetectorConfig(props, gestureConfig); |
|
0 commit comments