react-native-safe-area-context icon indicating copy to clipboard operation
react-native-safe-area-context copied to clipboard

TypeError: (0, _reactNativeSafeAreaContext.useSafeAreaInsets) is not a function

Open Edward-Upton opened this issue 6 years ago • 3 comments

Full Error: (0, _reactNativeSafeAreaContext.useSafeAreaInsets) is not a function. (In '(0, _reactNativeSafeAreaContext.useSafeAreaInsets)()', '(0, _reactNativeSafeAreaContext.useSafeAreaInsets)' is undefined)

I'm using Expo and so installed it using that, and after reinstalling I still get the issue. Looking through the files on GitHub and those that are installed in my package in node_modules there are major differences, and one being that in the src folder there are no files that declare the useSafeAreaInsets or SafeAreaInsetsContext.

Edit: And I have I just checked, installing with npm does include the useSafeAreaInsets, so looks like it is an issue with the Expo install.

Edward-Upton avatar Jul 01 '20 15:07 Edward-Upton

Turns out I needed to run the following commands npm install -g expo-cli expo update To update my expo SDK and fix the packages so that it was using the correct ones.

Edward-Upton avatar Jul 01 '20 15:07 Edward-Upton

In package.json update your react-native-safe-area-context to the newest version.

Example: "react-native-safe-area-context": "3.2.0",

martin-richter-uk avatar Apr 12 '21 16:04 martin-richter-uk

In package.json update your react-native-safe-area-context to the newest version.

Example: "react-native-safe-area-context": "3.2.0",

Thanks man! This safe my project and you made me feel so happy. Life returns it to you multiplied by a million 🙏🏻

RodrigoIbarraSanchez avatar Oct 02 '22 18:10 RodrigoIbarraSanchez