Reactjs react本机应用程序在实施redux后保持空白是否持续?
每个人 我正在尝试使用redux persist持久化我的商店,但在我的app.js中实现它后,我得到了白色屏幕,我查找了这个错误,我唯一能找到的是清除componentDidMount()中的持久化程序,即使这样也不适用于我: App.js:Reactjs react本机应用程序在实施redux后保持空白是否持续?,reactjs,react-native,redux,react-native-android,redux-persist,Reactjs,React Native,Redux,React Native Android,Redux Persist,每个人 我正在尝试使用redux persist持久化我的商店,但在我的app.js中实现它后,我得到了白色屏幕,我查找了这个错误,我唯一能找到的是清除componentDidMount()中的持久化程序,即使这样也不适用于我: App.js: import React from 'react'; import { AppLoading, Asset, Font } from 'expo'; import { PersistGate } from 'redux-persist/integrati
import React from 'react';
import { AppLoading, Asset, Font } from 'expo';
import { PersistGate } from 'redux-persist/integration/react';
import { Ionicons } from '@expo/vector-icons';
import { Provider } from 'react-redux';
import storeConfig from './config/store';
import RootNavigation from './navigation/RootNavigation';
import Splash from './screens/Splash'
const {persistor, store} = storeConfig();
//正常代码
你明白了吗?嘿,我用了redux-persist@4.10.2它就像一个符咒。因为很多故障排除都针对该版本。我希望这对你有帮助。
render() {
if (!this.state.isLoadingComplete ) {
return (
<AppLoading
startAsync={this._loadResourcesAsync}
onError={this._handleLoadingError}
onFinish={this._handleFinishLoading}
/>
);
} else {
return (
<Provider store={store}>
<PersistGate loading={<Splash /> } persistor={persistor}>
<RootNavigation />
</PersistGate>
</Provider>
);
}
import { createStore } from 'redux';
import { persistStore, persistReducer } from 'redux-persist'
import storage from 'redux-persist/lib/storage'
import logger from 'redux-logger';
import reducers from '../reducers';
const persistConfig = {
key: 'root',
storage,
};
const pReducer = persistReducer(persistConfig, reducers);
export const store = createStore(pReducer);
export const persistor = persistStore(store);