我最近建立了一个新的 React Native 项目,我使用 expo 在我的手机上进行了测试。
一开始运行良好,我可以使用 expo 的二维码在我的手机上启动应用程序而不会出现问题。然而,一段时间后它停止工作,当我现在尝试使用二维码博览会在我的手机上加载应用程序时,它卡在无休止的加载屏幕上。我没有收到任何错误消息,当我在浏览器中启动应用程序时,它加载得非常好,同样没有任何错误消息。
我尝试删除 node_modules 文件夹并使用 yarn 和 npm 重新安装它,就像推荐的那样,但它仍然不起作用。
我认为它是在我安装了一些软件包后启动的,但即使我删除了它,它仍然无法正常工作:
我安装的包(来自 package-lock.json 和 package.json(包完全一样)):
"@react-navigation/native": "^3.8.4","expo": "~42.0.1","expo-barcode-scanner": "~10.2.2","expo-splash-screen": "~0.11.2","expo-status-bar": "~1.0.4","expo-updates": "~0.8.1","react": "16.13.1","react-dom": "16.13.1","react-native": "~0.63.4","react-native-camera": "^4.0.0","react-native-gesture-handler": "~1.10.2","react-native-reanimated": "~2.2.0","react-native-screens": "~3.4.0","react-native-unimodules": "~0.14.5","react-native-web": "~0.13.12","react-navigation": "^4.4.4","react-navigation-stack": "^2.10.4"
我也从 App.js 中删除了路由并用一些基本代码替换了它,但它仍然不起作用:
import React from 'react';
import { Text,View } from 'react-native';
const YourApp = () => {
return (
<View style={{ flex: 1,justifyContent: "center",alignItems: "center" }}>
<Text>
Try editing me! ?
</Text>
</View>
);
}
export default YourApp;