-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
AsyncStorage.getItem() doesn't seem to work #18372
Comments
Thanks for posting this! It looks like your issue may refer to an older version of React Native. Can you reproduce the issue on the latest stable release? Thank you for your contributions. |
Updated |
I'm getting the same issue, and I'm using 0.54.0 react-native version, so what I can do to solve this? is It the stable version ? Actual Behavior
Environmentreact: |
Try to run the install command again, it may to work. |
@xiaonull did you mean I run |
Having the same issue with If you call |
Running into this issue sporadically on 0.54.2 on Android. |
It is really frustrating. after few time of running the app. Aysnc AsyncStorage.getItem() stops working. |
RN is pretty new to me, anyone know any of the maintainers on here we can ping to have a look? The implementation is definitely not stable, there is another issue here: #12830 Don't really fancy using SQLite just to store a couple of integer values 😕 |
I am thinking to use this as alternative : https://github.com/oblador/react-native-keychain |
Just to add to this, I've noticed that if I am using |
@AleskiWeb that is very stressful. Some alternative? |
same here ... |
let value = await AsyncStorage.getItem("user"); |
the same issue, is it supposed to work with expo app or the issue is global? |
Hello "dependencies": { I don't understand why it's not working... |
It's 2 years bug, same with hot reload bug. These bugs are so old that they are mascots for the RN. |
Any update on this? |
Same issue, still waiting for a fix! |
I also encountered the same issue. I was binding an async function in the UI of one screen. So whenever I was navigating to that screen, the app was getting stuck and restarting the app was not working. It was working only if i restart the expo app and then the project app. Please check whether an async function is getting invoked on render or not. That could be the issue of AsyncStorage not fetching any item because the previous async has not completed yet. Thanks. |
same issue...... |
This resolved the issue for me. On a related thread: #14101 (comment)
My native Android code had reference to an AsyncTask, which for some reason mucks with AsyncStorage. Once removed it works as intended. |
Same issue for me. |
Experiencing the same issue, AsyncStorage is just unusable. |
@hramos why is the bug report label removed when the issue is not resolved :( |
Hellp all,
I have had this issue once too making the app in production go freeze. what
a day that was.
what worked out for me for temporary solution was instead of getting and
setting value from asyncstorage. I used React natie file system (RNFS) and
used it as reading and writing file in app reserved root space which is not
accessible through file managers, and you're anyway going to store auth
tokens here or even you can encrypt/decrypt your stringified json there.
…On Tue 16 Oct, 2018, 02:57 Farzad Qasim ***@***.*** wrote:
same problem in expo
"react-native": "https://github.com/expo/react-native/archive/sdk-30.0.0.tar.gz",
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#18372 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AKauliyAL9MEA3L6T2GKK6nvC5E5Fa7Jks5ulP2xgaJpZM4SqYil>
.
|
Problem is not So, the solution (at least for me) is: not to use |
At last some valuable information! Thanks @Georgge |
This is still an issue, and the problem is not in using |
This issue has been moved to react-native-async-storage/async-storage#12. |
To fix the live reload - switching to async await worked for me. Checked this SO Answer (and vote up :-) ) |
Have you remembered to put the item in asyncstorage as string (JSON.stringify) and when reading the parse item (JSON.parse) ?? this may be the mistake of many. |
great !!! you save my day |
//Login.js .. //Welcome.js ...
} _bootstrapAsync = async () => { salir = () => { its works for me. |
I don't know what will be solution in your case but this one worked for me Firstely i was importing some componets from react-native like this and the AsyncStorage.getItem or AsyncStorage.setItem was not working, whatever code was there after AsunStorage was not running, so I Modified my import like to this and now everything was working fine. AsyncStorage.setItem('DEMO', 'false'); try {
|
Hi everyone,
Not just this I think. I've used your solution, but componentDidMount () { |
AsyncStorage.getItem(key) |
I found solution for this |
Even the custom Hooks (UseStorage) in React Native causing the same Problem. import {useState, useEffect} from 'react'; /* Hook for AsyncStorage */ const useStorage = (key, defaultValue) => {
} async function updateStorage(newValue) { useEffect(() => { return [storage, updateStorage]; export default useStorage; |
When I try to set a value via
AsyncStorage.getItem()
, I cannot request it back.Environment
Environment:
OS: macOS High Sierra 10.13.3
Node: 9.8.0
Yarn: 1.5.1
npm: 5.6.0
Watchman: 4.9.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: Not Found
Packages: (wanted => installed)
react: ^16.3.0-alpha.1 => 16.3.0-alpha.1
react-native: 0.54.0 => 0.54.0
Expected Behavior
Actual Behavior
Steps to Reproduce
The text was updated successfully, but these errors were encountered: