Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unsupported top level event type "onGestureHandlerStateChange dispatched in iphone X

I am facing an issue in react-navigation-drawer.

"react-native-gesture-handler": "^1.0.16",
"react-navigation": "^3.3.2"

This two version is installed. A drawer is working properly in Android and iPhone 5S. But, when I ran the app in iPhone X, it's throw error when I open drawer through gesture.

Unsupported top level event type "onGestureHandlerStateChange" dispatched

like image 524
Shashin Bhayani Avatar asked Feb 28 '19 10:02

Shashin Bhayani


People also ask

Where do I put GestureHandlerRootView?

with gesture handlers, the handlers need to be mounted under a single GestureHandlerRootView . So it's important to keep the GestureHandlerRootView as close to the actual root view as possible.

What is gesture handler in react native?

React Native Gesture Handler enables you to implement highly performant gestures in React Native because it runs in the native thread and follows platform-specific behavior, which in turn leads to better performance.


1 Answers

From this react-native-gesture-handler issue comment by balthazar:

Because my navigators were created asynchronously, the handler was registered too late and thus throwing this error. I fixed the issue by simply doing:

import 'react-native-gesture-handler';

at the top of my index.js 🙂

By index.js, balthazar is referring to your app's entrypoint – but I guess that the important thing is that it is imported before your first usage of react-native-gesture-handler.

like image 174
Jamie Birch Avatar answered Oct 09 '22 06:10

Jamie Birch