请求失败,状态为 403,react-native-screens.js,react-native-stack.js

Request failed with status 403, react-native-screens.js, react-native-stack.js

我是这个网站的新手。我正在使用 Expo Snack 开发移动应用程序。我对 React Navigation、React Native 有疑问。如果你能帮助我,我将不胜感激。

我在 React Navigation 中使用 StackNavigator 时进行了堆叠。前两天还好好的,突然报错

'Request failed with status 403: undefined Evaluating module://react-native-screens.js Evaluating module://react-navigation-stack.js....'

关于这个问题我的代码如下。

Nav.js

import { createStackNavigator } from 'react-navigation-stack';
import { createAppContainer } from 'react-navigation';

...

const Nav = createStackNavigator({...});
export default createAppContainer(Nav);

package.json

{
  "dependencies": {
    "color": "3.1.2",
    "lodash": "4.17.15",
    "react-navigation": "4.2.2",
    "native-base": "2.13.8",
    "react-navigation-stack": "2.2.3",
    "@react-native-community/masked-view": "0.1.1",
    "react-native-gesture-handler": "1.5.0",
    "react-native-safe-area-context": "0.6.0",
    "react-native-screens": "2.0.0-alpha.20"
  }
}

错误信息

Request failed with status 403: 
  Evaluating module://react-native-screens.js
  Evaluating module://react-navigation-stack.js
  Evaluating module://src/nav/Nav.js.js
  Evaluating module://App.js.js
  Loading module://App.js
Error: Request failed with status 403: 
    at Object.eval (module://react-native-screens.js!transpiled:1:113)
    at eval (module://react-native-screens.js!transpiled:2:4)
    at eval (module://react-native-screens.js!transpiled:3:3)
    at eval (<anonymous>)
    at [snack internals]
    at Object.n ([snack internals]
    at e.evaluate ([snack internals]
    at He ([snack internals]
    at [snack internals]
    at https://snack.expo.io/web-player/36/static/js/app.34240727.chunk.js:1:15674

我查看了 react-native-screens.js 的路径,但没有发现任何特别之处。但是有一点可疑的是react-native-screens的版本已经改了好几次了。不幸的是,我不记得前两天是什么了,当时还好好的,昨天不一样,今天又变了。

我也尝试将 react-navigation-stack 版本更改为 2.1.1,它工作正常,但运气不好...

很抱歉,这是一个如此模糊的问题,

谢谢。

我仍然没有找到解决方案,但不知何故,我找到了解决这个问题的方法。

将expo版本切换到v35.0.0,然后使用以下版本的各个库。

"react-navigation": "^4.2.2",
"react-native-screens": "^2.0.0-beta.2",
"react-navigation-stack": "2.1.1",
"react-native-gesture-handler": "^1.5.6",
"react-native-safe-area-context": "^0.7.2",
"@react-native-community/masked-view": "^0.1.1"

我仍然不明白为什么它不起作用,为什么现在起作用了。 如果有人知道为什么以及如何在 Expo v36.0.0 中使用,请 post 您的回答。

还有@vanion,对不起,我不知道如何提及你或联系你,但我希望你能找到这个,它会帮助你解决问题。

谢谢。

我不确定这个问题的原因是什么,但他们似乎已经从 react-navigation 中删除了 react-native-screens。因此,要解决此问题,您只需将 react-native-screens(第三方模块)安装到您的项目中即可。

要从 npm 运行 安装包到你的项目文件夹,

npm install --save react-native-screens@2.0.0-beta.2