类型错误:(0,_reactNativeScreens.useScreens)不是一个函数

new*_*ser 3 react-native react-native-navigation

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

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)
Run Code Online (Sandbox Code Playgroud)

首先,我收到此错误```错误:错误:无法解析模块:react-native-screensnode_modules\react-native-stack\src\NavigatorIos\index.js项目中找不到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.
Run Code Online (Sandbox Code Playgroud)

Zai*_*SMJ 7

该方法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();

PS 欲了解更多信息,请点击此处