Redux-Persist 不适用于 React-native@0.60.4
Redux-Persist not working on React-native@0.60.4
我已经使用 redux-persist 大约 6 个月了,它从来没有发生过,但是这次在我的新项目中 redux-persist 不工作我不知道是什么原因。请注意,我不能降级,因为我必须重新退出该项目,而我不能这样做。需要快速修复。
如有任何帮助,我们将不胜感激。谢谢
我的Package.json
"dependencies": {
"@ptomasroos/react-native-multi-slider": "^1.0.0",
"@react-native-community/async-storage": "^1.5.1",
"native-base": "2.12.1",
"react": "16.8.6",
"react-native": "0.60.4",
"react-native-animatable": "^1.3.2",
"react-native-calendar-picker": "^6.0.1",
"react-native-calendar-strip": "^1.3.8",
"react-native-calendars": "^1.200.0",
"react-native-document-picker": "^3.2.4",
"react-native-gesture-handler": "^1.3.0",
"react-native-image-picker": "^1.0.1",
"react-native-linear-gradient": "^2.5.4",
"react-native-parallax-scroll-view": "^0.21.3",
"react-native-permissions": "^1.2.0",
"react-native-progress-bar-animated": "^1.0.6",
"react-native-ratings": "^6.3.1",
"react-native-render-html": "^4.1.2",
"react-native-scaling-drawer": "^1.0.1",
"react-native-snap-carousel": "^3.8.0",
"react-native-splash-screen": "^3.2.0",
"react-native-star-rating": "^1.1.0",
"react-native-toast": "^1.0.1",
"react-native-vector-icons": "^6.6.0",
"react-native-wheel-picker-android": "^2.0.5",
"react-navigation": "^3.11.1",
"react-redux": "^7.1.0",
"redux": "^4.0.4",
"redux-persist": "5.6.12",
"redux-thunk": "^2.3.0",
"rn-range-slider": "^1.2.5"
},
"devDependencies": {
"@babel/core": "7.5.5",
"@babel/runtime": "7.5.5",
"@react-native-community/eslint-config": "0.0.3",
"babel-jest": "24.8.0",
"eslint": "6.0.1",
"jest": "24.8.0",
"metro-react-native-babel-preset": "0.54.1",
"react-test-renderer": "16.8.6"
},
"jest": {
"preset": "react-native"
}
}
我能够通过在我的 reduce 中添加 "persist/REHYDRATE" 操作来解决这个问题,但是我不知道这个操作的作用但解决了我的问题
case "persist/REHYDRATE":{
return{
...action.payload.global
}
}
Where global is the name of my reduces
我已经使用 redux-persist 大约 6 个月了,它从来没有发生过,但是这次在我的新项目中 redux-persist 不工作我不知道是什么原因。请注意,我不能降级,因为我必须重新退出该项目,而我不能这样做。需要快速修复。
如有任何帮助,我们将不胜感激。谢谢
我的Package.json
"dependencies": {
"@ptomasroos/react-native-multi-slider": "^1.0.0",
"@react-native-community/async-storage": "^1.5.1",
"native-base": "2.12.1",
"react": "16.8.6",
"react-native": "0.60.4",
"react-native-animatable": "^1.3.2",
"react-native-calendar-picker": "^6.0.1",
"react-native-calendar-strip": "^1.3.8",
"react-native-calendars": "^1.200.0",
"react-native-document-picker": "^3.2.4",
"react-native-gesture-handler": "^1.3.0",
"react-native-image-picker": "^1.0.1",
"react-native-linear-gradient": "^2.5.4",
"react-native-parallax-scroll-view": "^0.21.3",
"react-native-permissions": "^1.2.0",
"react-native-progress-bar-animated": "^1.0.6",
"react-native-ratings": "^6.3.1",
"react-native-render-html": "^4.1.2",
"react-native-scaling-drawer": "^1.0.1",
"react-native-snap-carousel": "^3.8.0",
"react-native-splash-screen": "^3.2.0",
"react-native-star-rating": "^1.1.0",
"react-native-toast": "^1.0.1",
"react-native-vector-icons": "^6.6.0",
"react-native-wheel-picker-android": "^2.0.5",
"react-navigation": "^3.11.1",
"react-redux": "^7.1.0",
"redux": "^4.0.4",
"redux-persist": "5.6.12",
"redux-thunk": "^2.3.0",
"rn-range-slider": "^1.2.5"
},
"devDependencies": {
"@babel/core": "7.5.5",
"@babel/runtime": "7.5.5",
"@react-native-community/eslint-config": "0.0.3",
"babel-jest": "24.8.0",
"eslint": "6.0.1",
"jest": "24.8.0",
"metro-react-native-babel-preset": "0.54.1",
"react-test-renderer": "16.8.6"
},
"jest": {
"preset": "react-native"
}
}
我能够通过在我的 reduce 中添加 "persist/REHYDRATE" 操作来解决这个问题,但是我不知道这个操作的作用但解决了我的问题
case "persist/REHYDRATE":{
return{
...action.payload.global
}
}
Where global is the name of my reduces