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

Async Storage is not working when I turn off debug or build app to production #271

Closed
giangnguyen712 opened this issue Dec 29, 2019 · 9 comments

Comments

@giangnguyen712
Copy link

Current behavior

I'm getting this weird bug, cause I have try many times with my old project, Async Storage still worked ok but not in this current project.
Problem is when I turn on debug for coding, the Async Storage save my data correctly. But after I turn off debug or build to production (.apk file). It didn't work anymore, data didn't setItem to save, no data return.

Expected behavior

setItem and getItem will work ok when turn off debug or build app to production.

Environment

"dependencies": {
"@react-native-community/async-storage": "^1.7.1",
"moment": "^2.24.0",
"react": "16.8.6",
"react-native": "0.61.5",
"react-native-axios": "^0.17.1",
"react-native-camera": "^3.8.0",
"react-native-datepicker": "^1.7.2",
"react-native-gesture-handler": "^1.4.1",
"react-native-image-zoom-viewer": "^2.2.27",
"react-native-loading-spinner-overlay": "^1.0.1",
"react-native-modal-dropdown": "^0.7.0",
"react-native-ratings": "^6.5.0",
"react-native-reanimated": "^1.3.0",
"react-native-screens": "^2.0.0-alpha.4",
"react-native-sectioned-multi-select": "^0.7.6",
"react-native-simple-radio-button": "^2.7.4",
"react-native-snap-carousel": "3.8.0",
"react-native-spinkit": "^1.5.0",
"react-native-vector-icons": "^6.6.0",
"react-native-webview": "^7.4.3",
"react-navigation": "^4.0.10",
"react-navigation-stack": "^1.9.4",
"react-redux": "^7.1.1",
"redux": "^4.0.1",
"redux-devtools-extension": "^2.13.8",
"redux-persist": "^6.0.0",
"redux-thunk": "^2.3.0",
"socket.io-client": "2.0.4"
},
"devDependencies": {
"@babel/core": "7.6.0",
"@babel/runtime": "7.6.0",
"babel-jest": "24.9.0",
"jest": "24.9.0",
"metro-react-native-babel-preset": "0.54.1",
"react-native-dotenv": "^0.2.0",
"react-test-renderer": "16.8.6",
"redux-logger": "^3.0.6"
},
"jest": {
"preset": "react-native"
}

@giangnguyen712
Copy link
Author

need help :(

@AndreasAnderssonBluedeer

Unfortunately the same issue for me. Only on some IOS devices (so far on IOS 12.2) Only on release build.

@krizzu krizzu added the LEGACY label Jan 18, 2020
@krizzu
Copy link
Member

krizzu commented Jan 18, 2020

I think what you might be experiencing is a condition race between you using Community's AsyncStorage and your dependencies using RN Core's AsyncStorage. Try to find if any of your dependency is doing so. If that's the case, I suggest to find different dependency or use AsyncStorage from the core.

@chrise86
Copy link

I'm also facing this issue. Can't see anything that's using RN Core's AS, and switching my usage to import from core does not help.

Anyone get anywhere with this?

@chrise86
Copy link

@giangnguyen712 this may seem like a random question, but are you doing any date manipulation with the data you're storing? It looks like that's been my issue all along.

Here is an explanation why.

@krizzu krizzu removed the LEGACY label Apr 12, 2020
@krizzu krizzu closed this as completed Apr 12, 2020
@Harendra-Sharma-1998
Copy link

The same issue I stuck with, Have you @giangnguyen712 got the solution for this?

@giangnguyen712
Copy link
Author

giangnguyen712 commented Jun 23, 2020

The same issue I stuck with, Have you @giangnguyen712 got the solution for this?

The issue happen with me because I used window atob and btoa, for encode purpose, and it got bugs in react native, the weird thing is it still works when turn on debug (this is my issue: https://stackoverflow.com/questions/42829838/react-native-atob-btoa-not-working-without-remote-js-debugging). If you use RN v0.61.5 or above, try to debug by using try catch in your function, you can view the log on terminal without turn on debug, it help me find my issue.

@tungduonghgg123
Copy link

@giangnguyen712 this may seem like a random question, but are you doing any date manipulation with the data you're storing? It looks like that's been my issue all along.

Here is an explanation why.

Exactly my issue, thanks!
I can store this during develoment Wed Jul 07 2021 15:29:44 GMT+0700 (Indochina Time) using moment().toDate(). However, on release mode, it does not work! I have to switch it to this form 2021-07-07T15:29:44+07:00 which is moment().format()

@dozsolti
Copy link

dozsolti commented Dec 5, 2022

For me it was: #814 (comment)

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

7 participants