Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR Invariant Violation: AsyncStorage has been removed from react-native core

I was trying to Upgrade my Expo SDK 46 to 48 - following the steps on Midium- https://blog.expo.dev/expo-sdk-48-ccb8302e231 but after following the upgrading commands, I started getting ERROR Invariant Violation: AsyncStorage has been removed from react-native core

Does anyone know how to fix this Error? Thank you for your help in advance.

enter image description here

This is the Error message that I am getting.

like image 553
David Landes Avatar asked Sep 17 '25 21:09

David Landes


1 Answers

As mentioned by Naveed above in comment. You most likely have an import in one of your js/ts files causing the error since AsyncStorage is no longer in React-Native.

This import is wrong: import { AsyncStorage } from 'react-native'

Make sure you have @react-native-async-storage/async-storage installed by following instructions here: https://react-native-async-storage.github.io/async-storage/docs/install/

Then change all imports from:

import { AsyncStorage } from 'react-native'

to

import AsyncStorage from '@react-native-async-storage/async-storage'

like image 78
Dustin Forsyth Avatar answered Sep 19 '25 12:09

Dustin Forsyth