-
-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Persist not working with AsyncStorage (React Native) #431
Comments
None of the persist methods for react native have worked for us either. |
@systemlevel How are you planning on implementing offline support instead? |
@ctrlplusb do you have any clue on this? |
solution is to slightly tweak the storage to serialize:
|
Thanks! I had to add This is what worked for me: import AsyncStorage from '@react-native-community/async-storage'
const storage = {
async getItem(key) {
return JSON.parse(await AsyncStorage.getItem(key))
},
async setItem(key, data) {
AsyncStorage.setItem(key, JSON.stringify(data))
},
async removeItem(key) {
AsyncStorage.removeItem(key)
}
}
export default storage |
easy-peasy: v3.2.0 & v3.3.0
expo: v~36.0.0
When using AsyncStorage, the entire expo app crashes.
Only when passing AsyncStorage to the persist config, like so. Putting 'localStorage' does not error.
Maybe down to not stringifying the values: https://stackoverflow.com/questions/49491485/error-react-native-ios-exception-nsdictionarym-length-unrecognised-select
The text was updated successfully, but these errors were encountered: