You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RNGH requires the package to be imported at the **top of the entry file** before anything else, this is usually your `App.js` or `index.js` file.
109
121
110
-
`react-native-gesture-handler` requires the package to be imported at the **top of the entry file** before anything else, this is usually your `App.js` or `index.js` file.
122
+
```tsx
123
+
import'react-native-gesture-handler';
124
+
import { AppRegistry } from'react-native';
111
125
112
-
<br />
126
+
importAppfrom'./App';
127
+
import { nameasappName } from'./app.json';
113
128
114
-
```tsx
115
-
import'react-native-gesture-handler';
116
-
import { AppRegistry } from'react-native';
129
+
AppRegistry.registerComponent(appName, () =>App);
130
+
```
117
131
118
-
importAppfrom'./App';
119
-
import { nameasappName } from'./app.json';
132
+
Also wrap your entry point with `<GestureHandlerRootView>` or `gestureHandlerRootHO`
If you are having trouble with pressing, swiping, or otherwise interacting with components it is likely the result of [React Native Gesture Handler](https://docs.swmansion.com/react-native-gesture-handler/docs/) not being properly setup.
266
+
267
+
:::note
268
+
269
+
If your React Native version is (>=0.68) you will need a version of >=2.0.0 for `react-native-gesture-handler` for your app to build.
270
+
271
+
:::
272
+
266
273
Be sure to follow all needed [additional steps](https://docs.swmansion.com/react-native-gesture-handler/docs/) to complete the installation.
267
274
268
275
This includes ensuring you import `react-native-gesture-handler` at the top of your app entry file.
@@ -271,7 +278,16 @@ This includes ensuring you import `react-native-gesture-handler` at the top of y
271
278
import 'react-native-gesture-handler';
272
279
```
273
280
274
-
And for Android you additionally need to update `MainActivity.java` to override the method for creating the `ReactRootView`.
281
+
Also do not forget to wrap your component tree(probably above `OverlayProvider`) with `<GestureHandlerRootView>` or `gestureHandlerRootHOC` as mentioned in [RNGH Installation docs](https://docs.swmansion.com/react-native-gesture-handler/docs/installation#js). Not doing so, can cause unusual behaviour with the `MessageOverlay` and `Imagegallery` gestures.
282
+
283
+
```tsx
284
+
<GestureHandlerRootViewstyle={{ flex: 1 }}>
285
+
<OverlayProvider>// Other underlying components</OverlayProvider>
286
+
</GestureHandlerRootView>
287
+
```
288
+
289
+
If you are using v1 of `react-native-gesture-handler` library, then you will need extra setup steps for Android.
290
+
Update `MainActivity.java` to override the method for creating the `ReactRootView` as mentioned in [RNGH Installation docs](https://docs.swmansion.com/react-native-gesture-handler/docs/installation#js).
@@ -298,10 +314,13 @@ public class MainActivity extends ReactActivity {
298
314
}
299
315
```
300
316
301
-
## Custom touchable not working
317
+
## Touchables Inside Custom Components Are Not Working
302
318
303
319
If you find that a customization that includes a touchable is not working, or the wrong element is receiving the touch event, this is likely related to [React Native Gesture Handler](https://docs.swmansion.com/react-native-gesture-handler/docs/).
304
-
Your component may be being rendered inside of a gesture handler; nested gesture handlers and touchables need special treatment and can act differently on iOS & Android.
320
+
The following could be the reasons behind the issues you might be facing:
321
+
322
+
- Your component may be being rendered inside of a gesture handler.
323
+
- Nested gesture handlers and touchables need special treatment and can act differently on iOS & Android. If you want Nested Touchables to work on Android you should add the prop `disallowInterruption` as mentioned [here](https://github.com/software-mansion/react-native-gesture-handler/issues/784#issuecomment-786471220).
305
324
306
325
There are solutions available for almost all use cases so looking into your specific use case in relation to React Native Gesture Handler is suggested.
307
326
The solution may require using a different touchable from React Native Gesture Handler and React Native depending on the platform.
0 commit comments