Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native ScrollView Crashes on Android APK

My app is working as expected in the debug mode

react-native run-android

but in the release build

react-native run-android --variant=release 

The app launches fine and I can navigate to all the pages, but whenever I try to scroll or press any view inside a ScrollView, it crashes. For example, in the code below, the HomeHeader component has two buttons that work well, but whenever I touch anything inside the ScrollView, Unfortunately it crashes. My code is as follow:

<SafeAreaView style={{flex:1}}>
  <HomeHeader/>
  <ScrollView>
      <SomeComponents/>
  </ScrollView>
</SafeAreaView>

Dependencies

"react-native": "^0.58.5",
"react-native-gesture-handler": "^1.0.10"

Error Log

Unsupported top level event type "onGestureHandlerStateChange" dispatched 03-20 21:42:49.156 21328 21372 E AndroidRuntime: FATAL EXCEPTION: mqt_native_modules 03-20 21:42:49.156 21328 21372 E AndroidRuntime: Process: com.munasabat, PID: 21328 03-20 21:42:49.156 21328 21372 E AndroidRuntime: com.facebook.react.common.JavascriptException: Unsupported top level event type "onGestureHandlerStateChange" dispatched, stack:

like image 306
Ahmed Imam Avatar asked Mar 16 '19 10:03

Ahmed Imam


1 Answers

There is a bug, found in Android version <= 1.0.14 (of react-native-gesture-handler), which is fixed in 1.0.15, but has the same issue in IOS and in later versions.
Use (up to date versions where possible):

 "react-native": "^0.58.0"
 "react-native-gesture-handler" "^1.1.0"
 "react-navigation": "^3.0.9"
like image 157
Jon Goodwin Avatar answered Oct 02 '22 12:10

Jon Goodwin