Reactjs Redux store(异步存储引擎)在调用store.dispatch时冻结iPhone
对于我们的ReactNative应用程序,我们通过使用内部存储来减少加载时间。 最初,来自redux存储的数据可以在进行api调用以更新数据时立即呈现。api调用完成后,最新的数据存储在Reactjs Redux store(异步存储引擎)在调用store.dispatch时冻结iPhone,reactjs,react-native,redux,react-redux,asyncstorage,Reactjs,React Native,Redux,React Redux,Asyncstorage,对于我们的ReactNative应用程序,我们通过使用内部存储来减少加载时间。 最初,来自redux存储的数据可以在进行api调用以更新数据时立即呈现。api调用完成后,最新的数据存储在store.dispatch中 在Android和模拟器上一切正常,但在iPhone X上,调用store.dispatch时应用程序会冻结。删除dispatch“解决”了这个问题 有什么问题吗?我们应该试试另一个存储引擎吗 编辑: 我根据我们的编码创建了一个基本的redux应用程序:。使用Expo客户端,这在i
store.dispatch
中
在Android和模拟器上一切正常,但在iPhone X上,调用store.dispatch时应用程序会冻结。删除dispatch“解决”了这个问题
有什么问题吗?我们应该试试另一个存储引擎吗
编辑:
我根据我们的编码创建了一个基本的redux应用程序:。使用Expo客户端,这在iPhone上运行良好。所以不可能重现这个问题
我们的store.js文件:
import {createStore, compose, applyMiddleware} from 'redux';
import thunk from 'redux-thunk';
import {persistCombineReducers, persistStore} from 'redux-persist';
import AsyncStorage from '@react-native-community/async-storage';
import {encryptTransform} from 'redux-persist-transform-encrypt';
const encryptor = encryptTransform({
secretKey: '******',
onError: function (error) {
// Handle the error.
console.log(error);
},
});
const config = {
key: 'primary',
storage: AsyncStorage,
transforms: [encryptor],
};
import {reducer as servicesReducer} from 'app/services/reducer';
const appReducer = persistCombineReducers(config, {
services: servicesReducer,
});
const enhancer = compose(applyMiddleware(thunk));
const store = createStore(appReducer, enhancer);
const persistor = persistStore(store);
export {store, persistor};
依赖项包.json
{
"dependencies": {
"npm": "^6.14.8",
"react": "16.13.1",
"react-native": "0.63.4",
"react-navigation": "^4.0.10",
"react-navigation-stack": "^1.9.4",
"react-redux": "^7.2.2",
"redux": "^4.0.5",
"redux-persist": "^6.0.0",
"redux-persist-transform-encrypt": "^3.0.1",
"redux-thunk": "^2.3.0",
"remote-redux-devtools": "^0.5.16",
},
}
这不是操作系统的问题,而是我存储的数据量。AsyncStorage有一个大小限制,有些帐户超过了这个限制。一些警告可能很有趣,或者是找出哪个减速器达到极限的一种方法 使用
arr.splice()。一切正常。但如果能知道我们在“安全区”的情况会很好