newUser
newUser

Reputation: 404

TypeError: (0, _reactNativeScreens.useScreens) is not a function

I searched for this error but I didn't find solution.

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)

First I get this error ``` error: Error: Unable to resolve module react-native-screens from node_modules\react-native-stack\src\NavigatorIos\index.js: react-native-screens could not be found within the project.


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.

Upvotes: 3

Views: 1904

Answers (1)

Zain SMJ
Zain SMJ

Reputation: 1632

Method useScreens is deprecated, please use enableScreens instead. Follow these steps:

1. Install dependencies

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

Or just expo install react-native-screens

2. Replace import

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

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

3. Replace function

Old: useScreens();

New: enableScreens();

P.S. For any further info click here.

Upvotes: 8

Related Questions