gpt4 book ai didi

android - 带有 React Navigation 5 的 Expo React Native 应用程序在从 Navigator 触摸初始屏幕时在 Android 上崩溃

转载 作者:行者123 更新时间:2023-12-02 06:53:52 25 4
gpt4 key购买 nike

问题:
在 android 上,我打开应用程序并到达导航器的初始屏幕,然后触摸它并完全崩溃(不显示错误)。

包.json:

"dependencies": {
"@apollo/react-hooks": "^3.1.3",
"@expo/vector-icons": "^10.0.6",
"@react-native-community/masked-view": "0.1.5",
"@react-native-community/netinfo": "^4.6.0",
"@react-navigation/bottom-tabs": "^5.0.5",
"@react-navigation/drawer": "^5.0.5",
"@react-navigation/native": "^5.0.5",
"@react-navigation/stack": "^5.0.9",
"@react-navigation/tabs": "0.0.0-alpha.12",
"add": "^2.0.6",
"apollo-boost": "^0.4.7",
"apollo-cache-inmemory": "^1.5.1",
"apollo-client": "^2.6.8",
"apollo-link": "^1.2.11",
"apollo-link-error": "^1.1.10",
"apollo-link-http": "^1.5.16",
"apollo-link-state": "^0.4.2",
"apollo-link-ws": "^1.0.17",
"aws-amplify": "^2.2.2",
"aws-amplify-react": "^3.1.6",
"aws-amplify-react-native": "^3.2.0",
"aws-appsync": "^3.0.2",
"aws-appsync-react": "^3.0.2",
"aws-sdk": "^2.610.0",
"expo": "^36.0.0",
"expo-font": "^8.0.0",
"expo-image-manipulator": "^8.0.0",
"expo-image-picker": "^8.0.2",
"graphql": "^14.6.0",
"graphql-tag": "^2.10.1",
"install": "^0.13.0",
"moments": "0.0.2",
"native-base": "^2.13.8",
"npm": "^6.13.7",
"react": "16.12.0",
"react-apollo": "^3.1.3",
"react-native": "https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz",
"react-native-clear-app-cache": "^1.0.4",
"react-native-elements": "^1.2.7",
"react-native-gesture-handler": "~1.5.0",
"react-native-image-grid": "^1.0.0",
"react-native-reanimated": "~1.4.0",
"react-native-responsive-screen": "^1.3.1",
"react-native-safe-area-context": "0.6.0",
"react-native-safe-area-view": "^1.0.0",
"react-native-screens": "2.0.0-alpha.12",
"react-native-star-rating": "^1.1.0",
"react-native-svg": "^9.13.3",
"react-native-svg-transformer": "^0.14.3",
"react-native-table-component": "^1.2.1",
"react-native-thumbnail-grid": "^0.3.0",
"react-native-vector-icons": "^6.6.0",
"react-ratings-declarative": "^3.4.1",
"subscriptions-transport-ws": "^0.9.16",
"uuid": "^3.4.0",
"yarn": "^1.21.1"
},

应用程序.json:
{
"expo": {
"name": "caballos-app",
"description": "This project is really great.",
"slug": "caballos-app",
"privacy": "public",
"sdkVersion": "36.0.0",
"platforms": ["ios", "android"],
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true
},
"packagerOpts": {
"config": "metro.config.js",
"sourceExts": ["js","jsx","svg","ts","tsx"]
}
}
}

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: [...sourceExts, "svg"]
}
};
})();

亚行日志猫:
02-27 17:38:58.521 32756 32756 E InputEventReceiver: Exception dispatching input event.
02-27 17:38:58.522 32756 32756 E MessageQueue-JNI: Exception in MessageQueue callback: handleReceiveCallback
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: java.lang.IllegalStateException: Already prepared or hasn't been reset
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.GestureHandler.prepare(GestureHandler.java:7)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.GestureHandlerOrchestrator.recordHandlerIfNotPresent(GestureHandlerOrchestrator.java:8)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.GestureHandlerOrchestrator.recordViewHandlersForPointer(GestureHandlerOrchestrator.java:5)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.GestureHandlerOrchestrator.traverseWithPointerEvents(GestureHandlerOrchestrator.java:12)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.GestureHandlerOrchestrator.extractGestureHandlers(GestureHandlerOrchestrator.java:5)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.GestureHandlerOrchestrator.onTouchEvent(GestureHandlerOrchestrator.java:4)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.react.RNGestureHandlerRootHelper.dispatchTouchEvent(RNGestureHandlerRootHelper.java:2)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.react.RNGestureHandlerRootView.dispatchTouchEvent(RNGestureHandlerRootView.java:1)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3073)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2709)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.react.RNGestureHandlerEnabledRootView.dispatchTouchEvent(RNGestureHandlerEnabledRootView.java:2)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3073)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2709)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3073)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2709)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3073)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2709)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3073)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2709)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3073)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2709)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3073)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2709)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3073)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2709)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:613)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1933)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at android.app.Activity.dispatchTouchEvent(Activity.java:4127)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at b.a.o.i.dispatchTouchEvent(WindowCallbackWrapper.java:1)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:559)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at android.view.View.dispatchPointerEvent(View.java:13763)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:5819)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5614)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5058)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5111)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5077)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5234)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5085)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5291)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5058)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5111)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5077)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5085)
02-27 17:38:58.523 32756 32756 E MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5058)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: FATAL EXCEPTION: main
02-27 17:38:58.527 32756 32756 E AndroidRuntime: Process: host.exp.exponent, PID: 32756
02-27 17:38:58.527 32756 32756 E AndroidRuntime: java.lang.IllegalStateException: Already prepared or hasn't been reset
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.GestureHandler.prepare(GestureHandler.java:7)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.GestureHandlerOrchestrator.recordHandlerIfNotPresent(GestureHandlerOrchestrator.java:8)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.GestureHandlerOrchestrator.recordViewHandlersForPointer(GestureHandlerOrchestrator.java:5)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.GestureHandlerOrchestrator.traverseWithPointerEvents(GestureHandlerOrchestrator.java:12)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.GestureHandlerOrchestrator.extractGestureHandlers(GestureHandlerOrchestrator.java:5)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.GestureHandlerOrchestrator.onTouchEvent(GestureHandlerOrchestrator.java:4)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.react.RNGestureHandlerRootHelper.dispatchTouchEvent(RNGestureHandlerRootHelper.java:2)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.react.RNGestureHandlerRootView.dispatchTouchEvent(RNGestureHandlerRootView.java:1)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3073)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2709)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at abi36_0_0.host.exp.exponent.modules.api.components.gesturehandler.react.RNGestureHandlerEnabledRootView.dispatchTouchEvent(RNGestureHandlerEnabledRootView.java:2)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3073)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2709)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3073)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2709)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3073)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2709)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3073)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2709)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3073)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2709)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3073)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2709)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3073)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2709)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:613)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1933)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at android.app.Activity.dispatchTouchEvent(Activity.java:4127)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at b.a.o.i.dispatchTouchEvent(WindowCallbackWrapper.java:1)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:559)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at android.view.View.dispatchPointerEvent(View.java:13763)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:5819)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5614)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5058)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5111)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5077)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5234)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5085)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5291)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5058)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5111)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5077)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5085)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5058)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:7949)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:7900)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:7854)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:8139)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:233)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at android.os.MessageQueue.nativePollOnce(Native Method)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at android.os.MessageQueue.next(MessageQueue.java:363)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at android.os.Looper.loop(Looper.java:173)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:8147)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
02-27 17:38:58.527 32756 32756 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101)

航海家:
import React from "react";
import SignUp from "./SignUp/SignUp";
import SignIn from "./SignIn"
import { createStackNavigator } from '@react-navigation/stack';

const Stack = createStackNavigator();

const AuthRouter = () => {

return(
<Stack.Navigator>
<Stack.Screen name="SignIn" component={SignIn} options={{ title: 'Ingresar' }} />
<Stack.Screen name="SignUp" component={SignUp} options={{ title: 'Registro' }} />
</Stack.Navigator>
)
}


export default AuthRouter;

应用程序.js:
if(loading) return <Loading/>
else return (
<ApolloProvider client={apolloClient}>
<NavigationContainer>
<AuthRouter/>
</NavigationContainer>
</ApolloProvider>
)

(我简化了一些对问题不重要的事情)

我知道这是导航器,因为我尝试使用单屏并且它不会崩溃。
我已经深入研究了所有相关的问题。也检查了 react 导航 5 故障排除。

有任何想法吗?
谢谢!

最佳答案

崩溃是因为覆盖 sourceExts .从您的 app.json 中删除这些行和 metro.config.js :

"sourceExts": ["js","jsx","svg","ts","tsx"]

https://github.com/react-navigation/react-navigation/issues/6919更多细节。

关于android - 带有 React Navigation 5 的 Expo React Native 应用程序在从 Navigator 触摸初始屏幕时在 Android 上崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60419703/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com