Async-storage: [iOS] Cannot get data set by react-native's AsyncStorage

Created on 15 Mar 2019  路  7Comments  路  Source: react-native-async-storage/async-storage

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:
bug iOS

Most helpful comment

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.

All 7 comments

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 )

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.

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

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.

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?

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.

:tada: This issue has been resolved in version 1.2.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

Was this page helpful?
0 / 5 - 0 ratings