react-navigation / react-navigation

Routing and navigation for your React Native apps
https://reactnavigation.org
23.48k stars 5.01k forks source link

Expo SDK 36.0.0 crash for "@react-navigation/native" only on Android, but always works with "react-navigation" regardless of the platform #6919

Closed sbrighiu closed 4 years ago

sbrighiu commented 4 years ago

Reason for posting I posted this so it gets seen with all search tags and associated issues.

Current Behavior I tried using react-navigation v5 in Expo and all works ok on iOS. When i was about to finish the app I switched to an Android device and the app would crash after starting.

After a few hours of debugging and trimming npm dependencies, I found that if I use any component from react-navigation v5 the app would crash when i touched the screen or crash immediately (expo crash).

Expected Behavior Not to crash :)

How to reproduce Create a new expo TypeScript (if this matters) project following their template and add "@react-navigation/native" as a dependency following the provided guides. Add a stack navigator with a single screen. Open the project on an android device. Tap/Swipe when the app opens.

Possible Associated Issues

6897

6267

Possible/Only Solution The problem seems to be "react-native-screens": "2.0.0-alpha.12" Request Expo to include the gradle dependencies in #6267.

Your Environment

software version
iOS or Android Android
@react-navigation/native 5.0.6
@react-navigation/stack 5.0.6
react-native-gesture-handler 1.5.0
react-native-safe-area-context 0.6.0
react-native-screens 2.0.0-alpha.12
react-native "https://github.com/expo/react-native/archive/sdk-36.0.1.tar.gz"
expo 36.0.0
node 12.8.0
npm or yarn 6.13.7
github-actions[bot] commented 4 years ago

Hey! Thanks for opening the issue. Can you provide a minimal repro which demonstrates the issue? Posting a snippet of your code in the issue is useful, but it's not usually straightforward to run. A repro will help us debug the issue faster. Please try to keep the repro as small as possible. The easiest way to provide a repro is on snack.expo.io. If it's not possible to repro it on snack.expo.io, then you can also provide the repro in a GitHub repository.

desi-ivanov commented 4 years ago

Steps to reproduce Init expo app and select blank typescript

expo init 

select typescript template > expo-template-blank-typescript

Then install react navigation requirements

npm install @react-navigation/native
expo install react-native-gesture-handler react-native-reanimated react-native-screens react-native-safe-area-context @react-native-community/masked-view

Install stack navigation

npm install @react-navigation/stack

Add the following options to app.json

    "expo":  {
        ...
        "packagerOpts": {
              "sourceExts": ["js", "ts", "tsx", "jsx"]
         }
    }

And this simple code in App.tsx

import React from "react"
import { View, Text } from "react-native"
import { NavigationContainer } from "@react-navigation/native"
import { createStackNavigator } from "@react-navigation/stack"
import { TouchableOpacity } from "react-native-gesture-handler";
const Stack = createStackNavigator();

export default function App() {
  return (
    <NavigationContainer>
      <Stack.Navigator>
        <Stack.Screen name="Asd">
          {() => <View><TouchableOpacity onPress={() => console.log("Press")}><Text>Hello</Text></TouchableOpacity></View>}
        </Stack.Screen>
      </Stack.Navigator>
    </NavigationContainer>
  );
}

then press the button and the app will crash without any information

Only happens on Android

satya164 commented 4 years ago

Can you repro it without changing sourceExts? I assume you also need to add .expo.js, .expo.ts, .expo.tsx as well. And because you're overriding the default ones, wrong files are being resolved and cause a crash.

sbrighiu commented 4 years ago

I've managed to make react-navigation 5 work on expo 35, but i would like it to work on 36 :(. If expo 35 is used, the app seems to be ok with everything

Package.json

{ "main": "node_modules/expo/AppEntry.js", "scripts": { "start": "expo start", "android": "expo start --android", "ios": "expo start --ios", "web": "expo start --web", "eject": "expo eject", "postinstall": "patch-package", }, "dependencies": { "@react-native-community/masked-view": "^0.1.5", "@react-navigation/bottom-tabs": "^5.0.5", "@react-navigation/native": "^5.0.5", "@react-navigation/stack": "^5.0.5", "expo": "35.0.0", "expo-asset": "~7.0.0", "expo-constants": "~7.0.0", "expo-font": "~7.0.0", "expo-intent-launcher": "~7.0.0", "lodash": "^4.17.15", "metro-config": "^0.58.0", "react": "^16.9.0", "react-dom": "16.9.0", "react-native": "https://github.com/expo/react-native/archive/sdk-35.0.0.tar.gz", "react-native-gesture-handler": "~1.3.0", "react-native-maps": "~0.25.0", "react-native-reanimated": "~1.2.0", "react-native-safe-area-context": "~0.3.6", "react-native-screens": "~1.0.0-alpha.23", "react-native-svg": "~9.9.2", "react-native-svg-transformer": "^0.14.3", "react-native-webview": "7.0.5", "react-redux": "^7.1.3", "redux": "^4.0.5", "redux-devtools-extension": "^2.13.8", "redux-promise-middleware": "^6.1.2", "redux-thunk": "^2.3.0", "uuid": "^3.4.0" }, "devDependencies": { "@babel/core": "^7.0.0", "@react-native-community/eslint-config": "^0.0.7", "@types/expo": "^33.0.1", "@types/jest": "^25.1.2", "@types/lodash": "^4.14.149", "@types/node": "^13.7.1", "@types/react": "^16.9.0", "@types/react-dev-utils": "^9.0.4", "@types/react-devtools": "^3.6.0", "@types/react-dom": "^16.9.5", "@types/react-native": "^0.60.15", "@types/react-native-maps": "^0.24.0", "@types/react-redux": "^7.1.7", "@types/react-test-renderer": "^16.9.2", "@types/redux": "^3.6.0", "@types/redux-promise-middleware": "^6.0.0", "@types/redux-thunk": "^2.1.0", "@types/uuid": "^3.4.7", "@types/webpack-env": "^1.15.1", "babel-preset-expo": "^8.0.0", "eslint": "^6.8.0", "@typescript-eslint/eslint-plugin": "^2.19.2", "eslint-config-prettier": "^6.10.0", "eslint-plugin-import": "^2.20.1", "eslint-plugin-jsx-a11y": "^6.2.3", "eslint-plugin-prettier": "^3.1.2", "eslint-plugin-react": "^7.18.3", "eslint-plugin-react-hooks": "^2.3.0", "eslint-plugin-react-native": "^3.8.1", "typescript-eslint": "^0.0.1-alpha.0", "metro-react-native-babel-preset": "^0.58.0", "patch-package": "^6.2.0", "prettier": "^1.19.1", "prettier-eslint": "^9.0.1", "react-native-dotenv": "^0.2.0", "typescript": "^3.7.2", "@typescript-eslint/parser": "^2.20.0" }, "assets": [ "./assets/fonts/" ], "private": true }

Also app.json for working project also contains

"packagerOpts": { "port": 8081, "config": "metro.config.js", "sourceExts": [ "js", "jsx", "svg", "ts", "tsx" ] }

satya164 commented 4 years ago

Please read my comment above https://github.com/react-navigation/react-navigation/issues/6919#issuecomment-589732008

If you're overriding sourceExts then it's a bug in your configuration. You need to account for .expo.xx files as well. Since you have overriden the default resolution, wrong files are resolved and cause a crash.

Closing since it's not a bug in React Navigation.

desi-ivanov commented 4 years ago

I've tried that without success

The bug happens only if I wrap the touchable opacity in a Stack.Screen

satya164 commented 4 years ago

Please provide a runnable repro. The example in this repo uses Expo 36 and it works without issues.

sbrighiu commented 4 years ago

These are the logcat logs

02-21 19:17:13.080 2997 3150 D WifiTrafficPoller: TrafficStats TxPkts=197986 RxPkts=548096 TxBytes=53674970 RxBytes=599550800 , Foreground uid=10703 pkgName=host.exp.exponent txBytes=51066875 rxBytes=510308666 02-21 19:17:14.098 2997 3150 D WifiTrafficPoller: TrafficStats TxPkts=197989 RxPkts=548101 TxBytes=53675269 RxBytes=599551367 , Foreground uid=10703 pkgName=host.exp.exponent txBytes=51067174 rxBytes=510309017 02-21 19:17:14.119 3406 3580 D NetworkController.MobileSignalController(0/-2): onSignalStrengthsChanged signalStrength=SignalStrength: 23 99 -23 -200 -23 -200 -1 99 2147483647 2147483647 2147483647 2147483647 0 2147483647 0x4 P gsm|lte level=4 02-21 19:17:14.119 3406 3580 D NetworkController.MobileSignalController(0/-2): getMobileIconGroup(): 0 02-21 19:17:14.126 4080 4080 D io_stats: !@ 179,0 r 289656 10825988 w 99543 2114460 d 9632 955272 f 31776 31688 iot 227010 221227 th 51200 0 0 pt 0 inp 0 0 16474.725 02-21 19:17:15.114 2997 3150 D WifiTrafficPoller: TrafficStats TxPkts=197995 RxPkts=548109 TxBytes=53675828 RxBytes=599552040 , Foreground uid=10703 pkgName=host.exp.exponent txBytes=51067733 rxBytes=510309487 02-21 19:17:15.601 2997 3107 I InputReader: Touch event's action is 0x0 (deviceType=0) [pCnt=1, s=0.611 ] when=16476202984000 02-21 19:17:15.602 2997 3106 I InputDispatcher: Delivering touch to (3406): action: 0x4, toolType: 1 02-21 19:17:15.602 2997 3106 I InputDispatcher: Delivering touch to (30660): action: 0x0, toolType: 1 02-21 19:17:15.602 30660 30660 D ViewRootImpl@20954ea[ExperienceActivity]: ViewPostIme pointer 0 02-21 19:17:15.617 30660 30660 E InputEventReceiver: Exception dispatching input event. 02-21 19:17:15.617 30660 30660 E MessageQueue-JNI: Exception in MessageQueue callback: handleReceiveCallback 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: java.lang.IllegalStateException: Already prepared or hasn't been reset 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.GestureHandler.prepare(GestureHandler.java:7) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.GestureHandlerOrchestrator.recordHandlerIfNotPresent(GestureHandlerOrchestrator.java:8) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.GestureHandlerOrchestrator.recordViewHandlersForPointer(GestureHandlerOrchestrator.java:5) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.GestureHandlerOrchestrator.traverseWithPointerEvents(GestureHandlerOrchestrator.java:12) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.GestureHandlerOrchestrator.extractGestureHandlers(GestureHandlerOrchestrator.java:5) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.GestureHandlerOrchestrator.onTouchEvent(GestureHandlerOrchestrator.java:4) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.react.RNGestureHandlerRootHelper.dispatchTouchEvent(RNGestureHandlerRootHelper.java:2) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.react.RNGestureHandlerRootView.dispatchTouchEvent(RNGestureHandlerRootView.java:1) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3172) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3172) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3172) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3172) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3172) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.react.RNGestureHandlerEnabledRootView.dispatchTouchEvent(RNGestureHandlerEnabledRootView.java:2) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3172) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3172) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3172) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3172) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3172) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3172) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3172) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:615) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1879) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.app.Activity.dispatchTouchEvent(Activity.java:3441) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at b.a.o.i.dispatchTouchEvent(WindowCallbackWrapper.java:1) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:577) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.View.dispatchPointerEvent(View.java:12880) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:5787) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5582) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5075) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5128) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5094) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.vie 02-21 19:17:15.619 30660 30660 D AndroidRuntime: Shutting down VM 02-21 19:17:15.620 30660 30660 E AndroidRuntime: FATAL EXCEPTION: main 02-21 19:17:15.620 30660 30660 E AndroidRuntime: Process: host.exp.exponent, PID: 30660 02-21 19:17:15.620 30660 30660 E AndroidRuntime: java.lang.IllegalStateException: Already prepared or hasn't been reset 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.GestureHandler.prepare(GestureHandler.java:7) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.GestureHandlerOrchestrator.recordHandlerIfNotPresent(GestureHandlerOrchestrator.java:8) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.GestureHandlerOrchestrator.recordViewHandlersForPointer(GestureHandlerOrchestrator.java:5) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.GestureHandlerOrchestrator.traverseWithPointerEvents(GestureHandlerOrchestrator.java:12) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.GestureHandlerOrchestrator.extractGestureHandlers(GestureHandlerOrchestrator.java:5) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.GestureHandlerOrchestrator.onTouchEvent(GestureHandlerOrchestrator.java:4) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.react.RNGestureHandlerRootHelper.dispatchTouchEvent(RNGestureHandlerRootHelper.java:2) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.react.RNGestureHandlerRootView.dispatchTouchEvent(RNGestureHandlerRootView.java:1) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3172) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3172) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3172) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3172) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3172) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.react.RNGestureHandlerEnabledRootView.dispatchTouchEvent(RNGestureHandlerEnabledRootView.java:2) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3172) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3172) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3172) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3172) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3172) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3172) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3172) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:615) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1879) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.app.Activity.dispatchTouchEvent(Activity.java:3441) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at b.a.o.i.dispatchTouchEvent(WindowCallbackWrapper.java:1) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:577) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.View.dispatchPointerEvent(View.java:12880) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:5787) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5582) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5075) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5128) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5094) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5231) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5102) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5288) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5075) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5128) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5094) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5102) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5075) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:7887) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:7827) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:7788) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:7998) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:198) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.os.MessageQueue.nativePollOnce(Native Method) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.os.MessageQueue.next(MessageQueue.java:325) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.os.Looper.loop(Looper.java:142) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7000) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:441) 02-21 19:17:15.620 30660 30660 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408) 02-21 19:17:15.622 2997 2997 D LightsService: [api] [SvcLED] turnOff:: id = 4 (uid: 1000 pid: 2997) 02-21 19:17:15.622 2997 2997 D LightsService: [api] [SvcLED] LED indicator : Not supported. 02-21 19:17:15.640 2624 2624 I display : [PrimaryDisplay] [DYNAMIC_RECOMP] first frame after HWC_2_GLES 02-21 19:17:15.640 2624 2624 I display : [PrimaryDisplay] [DYNAMIC_RECOMP] GLES_2_HWC by high FPS(5) 02-21 19:17:15.729 2997 3674 D ConnectivityService: filterNetworkStateForUid() uid: 10703 networkInfo: [type: WIFI[] - WIFI, state: CONNECTED/CONNECTED, reason: (unspecified), extra: "AB4 SYSTEMS", failover: false, available: true, roaming: false] 02-21 19:17:15.730 2997 9390 D Debug : !@DumpState : SHIP 02-21 19:17:15.730 2997 9390 D Debug : !@DumpState : debug level:0x4f4c 02-21 19:17:15.731 2997 9390 D Debug : !@Dumpstate : Finally, system will skip dumpstate 02-21 19:17:15.731 2997 9390 W ActivityManager: crash : host.exp.exponent,0 02-21 19:17:15.731 30660 30709 I System.out: (HTTPLog)-Static: isSBSettingEnabled false 02-21 19:17:15.732 2997 9390 W ActivityManager: Force finishing activity host.exp.exponent/.experience.ExperienceActivity 02-21 19:17:15.731 30660 30709 I System.out: (HTTPLog)-Static: isSBSettingEnabled false 02-21 19:17:15.732 2721 2863 D DnsProxyListener: DNSDBG::dns addrinfo af 2 02-21 19:17:15.734 2997 3106 D InputDispatcher: Waiting for application to become ready for input: 30660. Reason: Waiting because the touched window is paused. 02-21 19:17:15.743 30350 30350 I DMT-SMReceiver: Received : com.samsung.android.sm.ACTION_ERROR 02-21 19:17:15.744 30350 30350 W ContextImpl: Calling a method in the system process without a qualified user: android.app.ContextImpl.startService:1545 android.content.ContextWrapper.startService:669 android.content.ContextWrapper.startService:669 com.samsung.android.sm.common.SmartManagerReceiver.a:240 com.samsung.android.sm.common.SmartManagerReceiver.onReceive:119 02-21 19:17:15.748 2997 3017 I ActivityManager: Showing crash dialog for package host.exp.exponent u0 02-21 19:17:15.749 2997 3092 W ContextImpl: Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1033 com.samsung.android.hqm.BigDataModule.sendDQLog:1212 com.samsung.android.hqm.BigDataModule.sendHWParamDQServer:882 com.samsung.android.hqm.BigDataModule.sendHWParamServerLocked:778 com.samsung.android.hqm.BigDataModule.SendHQMInfoParam:535 02-21 19:17:15.761 2997 3675 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.stats.service.DropBoxEntryAddedReceiver 02-21 19:17:15.761 2997 3016 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.chimera.GmsIntentOperationService$PersistentTrustedReceiver 02-21 19:17:15.762 2997 3017 D ScrollView: initGoToTop 02-21 19:17:15.767 30378 30378 D DQA : get data intent 02-21 19:17:15.767 30378 30378 D DQA : save data

sbrighiu commented 4 years ago

And this part stands out for me. @satya164

02-21 19:17:15.601 2997 3107 I InputReader: Touch event's action is 0x0 (deviceType=0) [pCnt=1, s=0.611 ] when=16476202984000 02-21 19:17:15.602 2997 3106 I InputDispatcher: Delivering touch to (3406): action: 0x4, toolType: 1 02-21 19:17:15.602 2997 3106 I InputDispatcher: Delivering touch to (30660): action: 0x0, toolType: 1 02-21 19:17:15.602 30660 30660 D ViewRootImpl@20954ea[ExperienceActivity]: ViewPostIme pointer 0 02-21 19:17:15.617 30660 30660 E InputEventReceiver: Exception dispatching input event. 02-21 19:17:15.617 30660 30660 E MessageQueue-JNI: Exception in MessageQueue callback: handleReceiveCallback 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: java.lang.IllegalStateException: Already prepared or hasn't been reset 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.GestureHandler.prepare(GestureHandler.java:7) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.GestureHandlerOrchestrator.recordHandlerIfNotPresent(GestureHandlerOrchestrator.java:8) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.GestureHandlerOrchestrator.recordViewHandlersForPointer(GestureHandlerOrchestrator.java:5) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.GestureHandlerOrchestrator.traverseWithPointerEvents(GestureHandlerOrchestrator.java:12) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.GestureHandlerOrchestrator.extractGestureHandlers(GestureHandlerOrchestrator.java:5) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.GestureHandlerOrchestrator.onTouchEvent(GestureHandlerOrchestrator.java:4) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.react.RNGestureHandlerRootHelper.dispatchTouchEvent(RNGestureHandlerRootHelper.java:2) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.react.RNGestureHandlerRootView.dispatchTouchEvent(RNGestureHandlerRootView.java:1) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3172) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3172) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3172) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3172) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3172) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.react.RNGestureHandlerEnabledRootView.dispatchTouchEvent(RNGestureHandlerEnabledRootView.java:2) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3172) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3172) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3172) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3172) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3172) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3172) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3172) 02-21 19:17:15.619 30660 30660 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799)

satya164 commented 4 years ago

I know what the crash is. The problem is because you're overriding the extensions as I mentioned. If you cannot repro without overriding extensions, then your configuration needs to be fixed. You need to check what's the default value of sourceExts is and make sure that you don't remove anything when overriding.

sbrighiu commented 4 years ago

Is there any tool/command i can use to check if it is set up properly?

desi-ivanov commented 4 years ago

I know what the crash is. The problem is because you're overriding the extensions as I mentioned. If you cannot repro without overriding extensions, then your configuration needs to be fixed. You need to check what's the default value of sourceExts is and make sure that you don't remove anything when overriding.

Even if I maintain the override of sourceExts, the app crashes only if I put the buttons in a Stack screen

The following code works with the sourceExts set to "sourceExts": ["js","jsx","json","ts","tsx"]

import React from "react"
import { View, Text } from "react-native"
import { TouchableOpacity } from "react-native-gesture-handler";

export default function App() {
  return (
    <View style={{marginTop: 200}}>
<TouchableOpacity onPress={() => console.log("Press")}>
<Text>Hello</Text>
</TouchableOpacity>
</View>
  );
}

Then I wrap this view into a Stack.Screen and on any touch the app crashes

import React from "react"
import { View, Text } from "react-native"
import { NavigationContainer } from "@react-navigation/native"
import { createStackNavigator } from "@react-navigation/stack"
import { TouchableOpacity } from "react-native-gesture-handler";
const Stack = createStackNavigator();

export default function App() {
  return (
    <NavigationContainer>
      <Stack.Navigator>
        <Stack.Screen name="Asd">
          {() =>
            <View style={{ marginTop: 200 }}>
              <TouchableOpacity onPress={() => console.log("Press")}>
                <Text>Hello</Text>
              </TouchableOpacity>
            </View>
          }
        </Stack.Screen>
      </Stack.Navigator>
    </NavigationContainer>
  );
}

anyway I've downgraded Expo to 35.0.0 and gestures handler to 1.3 and it doesn't crash

sbrighiu commented 4 years ago

Can you provide the metro.config.js? @EvolveYourMind

desi-ivanov commented 4 years ago

Can you provide the metro.config.js? @EvolveYourMind

metro.config.js is NOT required to reproduce the bug

sbrighiu commented 4 years ago

For my use-case, i need 'react-native-svg-transformer', which requires a metro.config.js file as per https://github.com/kristerkari/react-native-svg-transformer. I've managed to fix it on expo 36. It seems expo and metro don't play nice as of expo 36.

app.json ...

"packagerOpts": { "port": 8081, "config": "metro.config.js" } ...

metro.config.js

const { getDefaultConfig } = require('metro-config'); module.exports = (async () => { const { resolver: { sourceExts, assetExts }, } = await getDefaultConfig(); return { transformer: { babelTransformerPath: require.resolve('react-native-svg-transformer'), }, resolver: { assetExts: assetExts.filter((ext) => ext !== 'svg'), sourceExts: ['expo.js', 'expo.ts', 'expo.tsx', ...sourceExts, 'ts', 'tsx', 'mjs', 'js', 'jsx', 'svg'], }, }; })();

sbrighiu commented 4 years ago

@EvolveYourMind use the TouchableOpacity from react-native :) It may be enough to fix your issue

sbrighiu commented 4 years ago

@satya164 thanks to the quick response. I've been working on debugging this for a while :)

satya164 commented 4 years ago

as I understand, expo.xx etc. should be before the regular js, tsx etc. extensions since they have higher priority, not after.

sbrighiu commented 4 years ago

@satya164 can you provide a link where i can read more about this? I will change it now. It's weird that the expo init project does not have this set up already.

satya164 commented 4 years ago

regardless, your best bet is to check what's the actual value that expo cli uses and add svg to it. that way order will be correct and you won't be missing anything. you might need to dig into expo cli's source code.

can you provide a link where i can read more about this

i just know that expo supports .expo.xx extensions and extension order matters. I have no idea regarding the complete list of the extensions that should be in the array. you'll need to dive into expo cli's source.

It's weird that the expo init project does not have this set up already.

I don't think expo init project has sourceExts in its app.json. it should just use default values defined internally. Since you're adding it, you're overriding the default values.

sbrighiu commented 4 years ago

By default in metro.config.js this is the console log of default config

{

resolver: { assetExts: [ 'bmp', 'gif', 'jpg', 'jpeg', 'png', 'psd', 'svg', 'webp', 'm4v', 'mov', 'mp4', 'mpeg', 'mpg', 'webm', 'aac', 'aiff', 'caf', 'm4a', 'mp3', 'wav', 'html', 'json', 'pdf', 'yaml', 'yml', 'otf', 'ttf', 'zip' ], platforms: [ 'ios', 'android', 'windows', 'web' ], sourceExts: [ 'js', 'json', 'ts', 'tsx' ], resolverMainFields: [ 'browser', 'main' ], extraNodeModules: {}, resolveRequest: null, hasteImplModulePath: undefined, blacklistRE: /(node_modules\/react\/dist\/.|website\/node_modules\/.|heapCapture\/bundle.js|.\/tests\/.)$/, useWatchman: true, virtualMapper: [Function: virtualMapper] }, serializer: { polyfillModuleNames: [], getRunModuleStatement: [Function: getRunModuleStatement], getPolyfills: [Function: getPolyfills], postProcessBundleSourcemap: [Function: postProcessBundleSourcemap], getModulesRunBeforeMainModule: [Function: getModulesRunBeforeMainModule], processModuleFilter: [Function: processModuleFilter], createModuleIdFactory: [Function: createModuleIdFactory], experimentalSerializerHook: [Function: experimentalSerializerHook], customSerializer: null }, server: { useGlobalHotkey: true, port: 8080, enhanceMiddleware: [Function: enhanceMiddleware], runInspectorProxy: true, verifyConnections: false }, symbolicator: { customizeFrame: [Function: customizeFrame] }, transformer: { assetPlugins: [], asyncRequireModulePath: 'metro/src/lib/bundle-modules/asyncRequire', assetRegistryPath: 'missing-asset-registry-path', babelTransformerPath: 'metro-babel-transformer', dynamicDepsInPackages: 'throwAtRuntime', enableBabelRCLookup: true, enableBabelRuntime: true, experimentalImportBundleSupport: false, getTransformOptions: [Function: getTransformOptions], minifierConfig: { mangle: [Object], output: [Object], sourceMap: [Object], toplevel: false, compress: [Object] }, minifierPath: 'metro-minify-uglify', optimizationSizeLimit: 153600, postMinifyProcess: [Function: postMinifyProcess], transformVariants: { default: {} }, workerPath: 'metro/src/DeltaBundler/Worker', publicPath: '/assets' }, cacheStores: [ FileStore { _root: '/var/folders/rk/91_m7b9j3bj_b4fk932xytg00000gn/T/metro-cache' } ], cacheVersion: '1.0', projectRoot: '', stickyWorkers: true, watchFolders: [], transformerPath: '/node_modules/metro/src/JSTransformer/worker.js', maxWorkers: 8, resetCache: false, reporter: TerminalReporter { _activeBundles: Map {}, _scheduleUpdateBundleProgress: [Function: debounced] { cancel: [Function: cancel], flush: [Function: flush] }, terminal: Terminal { _logLines: [], _nextStatusStr: '', _scheduleUpdate: [Function], _statusStr: '', _stream: [Socket] } } }

sbrighiu commented 4 years ago

As I see it the 'sourceExts' field is not taken into account when put in app.json and as far as I can see no example including it is available in expo docs

satya164 commented 4 years ago

Please check the source code of Expo CLI as I mentioned

https://github.com/expo/expo-cli/blob/52eb39ea0fbfd8bf3c45df6163bd554f3e4156c2/packages/xdl/src/Project.ts#L1797 https://github.com/expo/expo-cli/blob/0ac2dbf5a73ced106704373368b5e07caff8c5da/packages/config/src/paths/extensions.ts#L54

sbrighiu commented 4 years ago

Yup i see now the order clearly checked here https://github.com/expo/expo-cli/blob/d2193c844e0a3dd8a2ba333650033b6c8bdec8c0/packages/config/src/paths/__tests__/__snapshots__/extensions-test.js.snap and no android tests :(

fakingfantastic commented 4 years ago

I was running into this exact issue and I found this issue... I can confirm I was able to fix it by adding this to the dependencies object in android/app/build.gradle

implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"

Hope that helps

triannguyen commented 4 years ago

It seems expo and metro don't play nice as of expo 36.

I can confirm by removing the following config in app.json stops my app from crashing on screen press:

"packagerOpts": {
      "config": "metro.config.js",
      "sourceExts": ["js", "jsx", "ts", "tsx", "svg"]
}

(code used to configure the react native packager for react-native-svg-transformer)

implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"

Is there a workaround for Expo?

rodriguezmanu commented 4 years ago

+1

glennreyes commented 4 years ago

Here's a workaround for the ones who use expo & react-native-svg-transformer:

  "packagerOpts": {
    "sourceExts": [
      "expo.ts",
      "expo.tsx",
      "expo.js",
      "expo.jsx",
      "ts",
      "tsx",
      "js",
      "jsx",
      "json",
      "wasm",
      "svg"
    ]
  }
sbrighiu commented 4 years ago

I posted a solution that can use metro config. Just dont include sourceExts in app.json


Stefan Brighiu Software Engineer @ AB4 Systems Phone: +40 744 581 921 Web: http://ab4.systems On 27 Feb 2020, 20:01 +0200, Glenn Reyes notifications@github.com, wrote:

Here's a workaround for the ones who use react-native-svg-transformer: "packagerOpts": { "sourceExts": [ "expo.ts", "expo.tsx", "expo.js", "expo.jsx", "ts", "tsx", "js", "jsx", "json", "wasm", "svg" ] } — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

bisk8s commented 4 years ago

Can you repro it without changing sourceExts? I assume you also need to add .expo.js, .expo.ts, .expo.tsx as well. And because you're overriding the default ones, wrong files are being resolved and cause a crash.

Thanks!

dayaki commented 4 years ago

I posted a solution that can use metro config. Just dont include sourceExts in app.json

Just a note, I include sourceExts in my app.json and it still works. "packagerOpts": { "config": "metro.config.js", "sourceExts": [ "expo.ts", "expo.tsx", "expo.js", "expo.jsx", "ts", "tsx", "js", "jsx", "json", "wasm", "svg", "svgx" ] },

Ferin79 commented 4 years ago

I know what the crash is. The problem is because you're overriding the extensions as I mentioned. If you cannot repro without overriding extensions, then your configuration needs to be fixed. You need to check what's the default value of sourceExts is and make sure that you don't remove anything when overriding.

Even if I maintain the override of sourceExts, the app crashes only if I put the buttons in a Stack screen

The following code works with the sourceExts set to "sourceExts": ["js","jsx","json","ts","tsx"]

import React from "react"
import { View, Text } from "react-native"
import { TouchableOpacity } from "react-native-gesture-handler";

export default function App() {
  return (
    <View style={{marginTop: 200}}>
<TouchableOpacity onPress={() => console.log("Press")}>
<Text>Hello</Text>
</TouchableOpacity>
</View>
  );
}

Then I wrap this view into a Stack.Screen and on any touch the app crashes

import React from "react"
import { View, Text } from "react-native"
import { NavigationContainer } from "@react-navigation/native"
import { createStackNavigator } from "@react-navigation/stack"
import { TouchableOpacity } from "react-native-gesture-handler";
const Stack = createStackNavigator();

export default function App() {
  return (
    <NavigationContainer>
      <Stack.Navigator>
        <Stack.Screen name="Asd">
          {() =>
            <View style={{ marginTop: 200 }}>
              <TouchableOpacity onPress={() => console.log("Press")}>
                <Text>Hello</Text>
              </TouchableOpacity>
            </View>
          }
        </Stack.Screen>
      </Stack.Navigator>
    </NavigationContainer>
  );
}

anyway I've downgraded Expo to 35.0.0 and gestures handler to 1.3 and it doesn't crash

How to downgrade expo sdk to 35 from 37 or 36

1uokun commented 2 years ago

A @react-navigation specific version and its all dependencies must be met

"dependencies": {
    "react-native-screens": "~3.11.1",
    "@react-navigation/stack": "^5.9.0",
    "@react-navigation/native": "5.0.5",
    "react-native-gesture-handler": "~2.2.1",
    "react-native-safe-area-context": "4.2.4",
    "@react-native-community/masked-view": "^0.1.0"
  }

Demo like : https://snack.expo.dev/@1uokun/e9e6f0

github-actions[bot] commented 2 years ago

Hey! This issue is closed and isn't watched by the core team. You are welcome to discuss the issue with others in this thread, but if you think this issue is still valid and needs to be tracked, please open a new issue with a repro.