Skip to content

[iOS] Cannot get data set by react-native's AsyncStorage #40

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

Closed
ohnishiakira opened this issue Mar 15, 2019 · 7 comments · Fixed by #46
Closed

[iOS] Cannot get data set by react-native's AsyncStorage #40

ohnishiakira opened this issue Mar 15, 2019 · 7 comments · Fixed by #46
Labels
bug Something isn't working platform: iOS This is iOS specific

Comments

@ohnishiakira
Copy link

Current behavior

  • On iOS, data (set by react-native core's AsyncStorage) cannot be accessed from this library's AsyncStorage.

Expected behavior

  • Data can be accessed from both AsyncStorage.

Repro steps

  • react-native init Sample --version 0.59.0
  • yarn add @react-native-community/[email protected]
  • Use AsyncStorage in react-native and set data using AsyncStorage.setItem
  • then Use AsyncStorage in @react-native-community/async-storage and get data using AsyncStorage.getItem

Environment

  • Async Storage version: 1.2.1
  • React-Native version: 0.59.0
  • Platform tested: iOS
  • Logs/Error that are relevant:
@ohnishiakira
Copy link
Author

I create sample counter app using this App.js.
https://gist.github.com/ohnishiakira/212d82ae68396b7b9b5f40d41ab63de7

Here is desktop recording and operation logs.

https://youtu.be/tb7yzNBmTRg

  1. start app. Currently using react-native's AsyncStorage ( count is 0 )
  2. tap "increment" button 3 times ( count is 3 )
  3. move to text editor and update App.js to using react-native-community/async-storage's AsyncStorage
  4. reload app ( count backs to 0! )
  5. tap "increment" button 4 times ( count is 4 )
  6. move to text editor and update App.js to using react-native's AsyncStorage again
  7. reload app ( count is 3 )

@krizzu krizzu added bug Something isn't working platform: iOS This is iOS specific labels Mar 15, 2019
@krizzu
Copy link
Member

krizzu commented Mar 15, 2019

Hi @ohnishiakira , thanks for your input!

I believe this is because we've changed the name of a directory, where data is being saved.

This is our current name

react-native version

I cannot test it right now, but I'd like to see if it's the case.

@thientnc-ibl
Copy link

@krizzu , I think this bug is very serious. Can you release new version soon?

@krizzu
Copy link
Member

krizzu commented Mar 19, 2019

Hey @thientnc-ibl

Sure, but first, we have to discuss a way to add backward compatibility - maybe add a feature that allows different db/directory name.

@fodjan-philip
Copy link

What is the reason for the directory name change? I guess everyone who migrates from React Native's AsyncStorage expects the old data to be accessible, so shouldn't the default name of the directory be the same as before?

@krizzu
Copy link
Member

krizzu commented Mar 19, 2019

That must have been the whirlwind of changes I did while detaching from RN Core.
I'm happy to revert it back, merge and release it, then think about adding a feature to change it in the future.

Let me know if anyone would like to work on it or should I do it.

Thanks.

@krizzu
Copy link
Member

krizzu commented Mar 26, 2019

🎉 This issue has been resolved in version 1.2.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working platform: iOS This is iOS specific
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants