redux-presist not working with android

Author: Moemen02Created Feb 16, 2023Updated Jul 23, 2026

So I have just started an expo project, and I am using redux-presist. My problem is that the state is loading fine on ios. But it's not working on android. When I save my code with live reload it is working fine. But when I restart the app it is not getting the storage data. It is only getting it when I save a change in the code (so when it live reloads). There are no problems on IOS.

this is my store.js:

bash
import {combineReducers, configureStore} from '@reduxjs/toolkit'
import {setFirstname, userSlice} from "./user/userSlice";
import AsyncStorage from '@react-native-async-storage/async-storage';
import { persistStore, persistReducer } from 'redux-persist'
import {FLUSH, PAUSE, PERSIST, PURGE, REGISTER, REHYDRATE} from "redux-persist/es/constants";

const persistConfig = {
    key: 'root',
    storage: AsyncStorage,
}

const persistedReducer = persistReducer(persistConfig, userSlice.reducer)

export const store = configureStore({
    reducer: persistedReducer,
    middleware: (getDefaultMiddleware) =>
        getDefaultMiddleware({
            serializableCheck: {
                ignoredActions: [FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER],
            },
        }),
})

export const persistor = persistStore(store)

export default store

And this is my app.js

bash
import { StatusBar } from 'expo-status-bar';
import { StyleSheet } from 'react-native';
import React, {useEffect, useState} from 'react';
import BottomNav from "./app/navigations/BottomNav";
import 'react-native-gesture-handler'
import StackNav from "./app/navigations/StackNav";
import {NavigationContainer} from "@react-navigation/native";
import {navigationRef} from "./app/navigations/RootNavigation";
import {Provider} from "react-redux";
import {persistor, store} from "./app/store/store";
import {PersistGate} from "redux-persist/integration/react";
import SpinningLogo from "./app/ui/SpinningLogo";

export default function App() {
    const [isAuth, setAuth] = useState(null)

    useEffect(() => {
        console.log(store.getState().userToken)
        if (store.getState().userToken){
            setAuth(true)
        }
    })

    return (
        <Provider store={store}>
            <PersistGate loading={<SpinningLogo/>} persistor={persistor}>
                <NavigationContainer ref={navigationRef}>
                    <StatusBar style="light" />
                    {isAuth ? (
                        <BottomNav/>
                    ): <StackNav />}
                </NavigationContainer>
            </PersistGate>
        </Provider>
    );
}

const styles = StyleSheet.create({
  container: {
    
  },
});