8

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

Shashin Bhayani
  • 1,551
  • 3
  • 16
  • 37

3 Answers3

31

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.

Jamie Birch
  • 5,839
  • 1
  • 46
  • 60
9

If your RN version is above 0.60+

In my case, you should firstly add import 'react-native-gesture-handler'; in your top index.js file.

Then upgrade your react-native-gesture-handler to version >= 1.5.1 because the maintainer fixed a crash problem in IOS and you can see the closed issue here issue#320

Leo Chan
  • 91
  • 1
  • 1
2

Downgrade to v1.0.14 fixes the issue for me

Annie Tan
  • 259
  • 4
  • 14