On some phones, we encounter this error.
Current versions:
react-native-gesture-handler: 1.6.0
Expo client: 2.15.4
RN: sdk 37
There is a closed issue with the problem. People are recommending to
import 'react-native-gesture-handler' in App.js
Unfortunately, it does not help.
There are some related closed issues where people still report this error
https://github.com/software-mansion/react-native-gesture-handler/issues/320
https://github.com/software-mansion/react-native-gesture-handler/issues/439
This works for me
https://github.com/software-mansion/react-native-gesture-handler/issues/320#issuecomment-463341145
just a bit refactored:
import { NativeModules } from 'react-native'
const { UIManager } = NativeModules
if (UIManager) {
UIManager.genericDirectEventTypes = {
...UIManager.genericDirectEventTypes,
onGestureHandlerEvent: { registrationName: 'onGestureHandlerEvent' },
onGestureHandlerStateChange: {
registrationName: 'onGestureHandlerStateChange',
},
}
}
...
import React, { Component } from 'react'
Most helpful comment
This works for me
https://github.com/software-mansion/react-native-gesture-handler/issues/320#issuecomment-463341145
just a bit refactored: