Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.
like image 510
newUser Avatar asked Jul 14 '26 17:07

newUser


1 Answers

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.

like image 147
Zain SMJ Avatar answered Jul 24 '26 02:07

Zain SMJ



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!