'react-native-safe-area-context' module not found
P粉928591383
P粉928591383 2024-03-20 09:03:29
0
1
370

I'm learning React Native. I'm trying to use SafeAreaProvider and SafeAreaView, but when I do this:

import { SafeAreaProvider, SafeAreaView } from "react-native-safe-area-context";

I get the message that the module "react-native-safe-area-context" cannot be found

This is my version:

"dependencies": {
    "@react-native-community/masked-view": "^0.1.11",
    "expo": "~48.0.18",
    "expo-status-bar": "~1.4.4",
    "react": "18.2.0",
    "react-native": "0.71.8",
    "react-native-safe-area-context": "4.5.0",
    "react-navigation": "^4.4.4"

Can you help me? Thank you so much!

I tried downgrading react-native-safe-area-context from 4.7.1 to 4.5

P粉928591383
P粉928591383

reply all(1)
P粉593649715

You received the error message "Module 'react-native-safe-area-context' not found" because the SafeAreaContext library is not installed in your environment.

This library is included with Expo Go, but if you are using NPM you should follow the instructions here.

Run the following command in your environment terminal to install the library locally:

- npx expo install react-native-safe-area-context

If this command does not work, try using the following command:

npx expo install react-native-screens react-native-safe-area-context
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template