Home  >  Q&A  >  body text

'react-native-safe-area-context' module not found

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粉928591383P粉928591383184 days ago306

reply all(1)I'll reply

  • P粉593649715

    P粉5936497152024-03-21 00:24:22

    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

    reply
    0
  • Cancelreply