Please provide the following:
- SDK Version: 36.0.0
- Platforms(Android/iOS/web/all): Android
Hello! I am trying to save user’s authentication token in localStorage.
In React native doc, AsyncStorage is deprecated and recommend using react-native-community/ async-storage
So I just installed V2 of that package. then I created localDeviceStorage.js and code looks like this.
1 import AsyncStorageFactory from '@react-native-community/async-storage';
2 import LegacyStorage from '@react-native-community/async-storage-backend-legacy';
3
4
5 const legacyStorage = new LegacyStorage();
6 export const storage = AsyncStorageFactory.create(legacyStorage);
~
~
then tried to save storage.set("userToken", token);
But I got an error while building app.
Error:[@RNC/AsyncStorage]: NativeModule: AsyncStorage is null.
In document of react-native-community/async-storage says
If you have an Expo app, AsyncStorage will not work unless you eject the app. After ejecting the app, you may have to manually link depending on whether you chose to use Expo SDK.
Do I need to eject the app for using new async-storage? or is there any workaround?
What is the difference between managed and bare workflow? Can I use expo sdk(like AppAuth for logging in using Facebook) in bare workflow?
I need your help!