Skip to content
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

iOS(React Native): store persist not working with AsyncStorage #674

Closed
pranoppal opened this issue Jun 21, 2021 · 2 comments
Closed

iOS(React Native): store persist not working with AsyncStorage #674

pranoppal opened this issue Jun 21, 2021 · 2 comments

Comments

@pranoppal
Copy link

pranoppal commented Jun 21, 2021

The app is not able to persist redux state offline in iOS side of the app, but it's working perfectly fine with Android app.

  • Below is the createstore :
import {createStore, persist} from 'easy-peasy';
import userStore from './models/user';
import customStorage from './customStorage';


const store = createStore(
    persist(
        {
            userStore: userStore,
        },
        {
            storage: customStorage,
        },
    ),
    {
        disableImmer: true,
    },
);

export default store;
import AsyncStorage from '@react-native-async-storage/async-storage';

const storage = {
  async getItem(key) {
    return JSON.parse(await AsyncStorage.getItem(key));
  },
  setItem(key, data) {
    AsyncStorage.setItem(key, JSON.stringify(data));
  },
  removeItem(key) {
    AsyncStorage.removeItem(key);
  },
};

export default storage;
  • easy peasy package version in package.json:
"easy-peasy": "^5.0.3",

Any help would be appreciated, thank you!!

@chenghuiyuan
Copy link

Related to: #599

@pranoppal
Copy link
Author

Duplicate issue #599 , thankss!.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants