[SDK 33] AsyncStorage from 'react-native' deprecated, but community version is not present

I’ve upgraded to SDK 33 and I noticed these warnings:

Warning: Async Storage has been extracted from react-native core and will be removed in a future release. It can now be installed and imported from '@react-native-community/async-storage' instead of 'react-native'. See https://github.com/react-native-community/react-native-async-storage

So, I changed my all of these lines:

import { AsyncStorage } from 'react-native'

to

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

which gave me a redbox with this (abbreviated):

[@RNC/AsyncStorage]: NativeModule: AsyncStorage is null.

What to do here? It seems that Expo needs to provide AsyncStorage as indicated here: https://expo.canny.io/feature-requests/p/continued-support-for-asyncstorage but also as indicated there, the warnings I’m seeing are unexpected. It also seems that Expo’s docs for AsyncStorage are a bit misleading.

(Aside: not sure there’s anything Expo can do about this, but it’s a bit misleading to see the redbox with this error, which suggests react-native link to fix the problem - which of course won’t work when I’m not actually building the app, but instead using the Expo app.)

Hey @brettdh, sorry about this.

I’ve gone ahead and updated the docs to reflect that we still recommend importing from react-native :+1: Thanks for bringing this up!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.