【问题标题】:TypeError: (0, _reactNativeScreens.useScreens) is not a functionTypeError: (0, _reactNativeScreens.useScreens) 不是函数
【发布时间】:2020-12-04 18:15:27
【问题描述】:

我搜索了这个错误,但没有找到解决方案。

TypeError: (0, _reactNativeScreens.useScreens) is not a function. (In '(0, _reactNativeScreens.useScreens)()', '(0, _reactNativeScreens.useScreens)' is undefined)
 Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)
 Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)

首先我得到这个错误 ``` 错误:错误:无法从node_modules\react-native-stack\src\NavigatorIos\index.js 解析模块react-native-screens:在项目中找不到react-native-screens。


After this error I installed
```npm install react-native-reanimated react-native-gesture-handler react-native-screens react-native-safe-area-context @react-native-community/masked-view``` 

I am trying to run in android.

【问题讨论】:

    标签: react-native react-native-android react-native-navigation


    【解决方案1】:

    方法useScreens 已弃用,请改用enableScreens。请按以下步骤操作:

    1.安装依赖项

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

    或者只是expo install react-native-screens

    2。替换导入

    旧:import { useScreens } from 'react-native-screens';

    新:import { enableScreens } from 'react-native-screens';

    3.替换函数

    旧:useScreens();

    新:enableScreens();

    附注如需更多信息click here

    【讨论】:

      猜你喜欢
      • 2020-03-03
      • 1970-01-01
      • 2022-01-08
      • 2021-06-30
      • 2020-08-04
      • 2022-01-22
      • 2021-02-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多