Pure React Native app crashes on swiping after opening it in Release mode

Viewed 1841

I am using React-Navigation for my pure RN 0.61.2 app. The app runs perfectly when I use it on Debug mode. However, in Release mode when I try to open the Drawer Navigation menu or scroll down in a Tab menu, the app crashes immediately.

Dependencies:

...
  "dependencies": {
    "@react-native-community/async-storage": "^1.6.2",
    "@react-native-community/netinfo": "^4.4.0",
    "@react-native-community/slider": "^2.0.2",
    "react": "16.9.0",
    "react-native": "0.61.2",
    "react-native-admob": "^2.0.0-beta.6",
    "react-native-gesture-handler": "^1.4.1",
    "react-native-reanimated": "^1.3.0",
    "react-native-screens": "1.0.0-alpha.23",
    "react-native-vector-icons": "^6.6.0",
    "react-navigation": "^4.0.10",
    "react-navigation-drawer": "^2.2.2",
    "react-navigation-stack": "^1.9.3",
    "react-navigation-tabs": "^2.5.5"
  },
...

I've already added these lines of code to android/app/build.gradle's dependencies:

    implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02'

In App.js, I tried

import {enableScreens} from 'react-native-screen';
enableScreens();

and also

import {useScreens} from 'react-native-screen';
useScreens();

with 2.0.0-alpha.1, 2.0.0-alpha.3 and 1.0.0-alpha.23 versions of react-native-screens.

Yet, still I am getting the same result: Debug mode is perfectly working, Release mode is dramatically crashing after a Drawer Navigation swipe or a Tab Navigation scroll.


THE SOLUTION I used adb logcat and saw this:

ReactNativeJS: Invariant Violation: Unsupported top level event type "onGestureHandlerStateChange" dispatched

I googled it and found that some guys have fixed it by importing 'react-native-gesture-handler' on the top of the 'app.js' file. So I've added:

import 'react-native-gesture-handler'

and it is working perfectly now!

0 Answers
Related