amplify-js: AsyncStorage wrong import - removed from react-native and moved to different package

Describe the bug AsyncStorage has been removed from react-native and moved to a new package @react-native-community/async-storage which means developers that have react-native version >=0.60 doesn’t have the functionality that is related to async storage. So for example when users exit the app the login data is not saved and they need to login again, which is very frustrating. I have looked at your code and there are many files that use AsyncStorage from react-native, this needs to be changed to the new package @react-native-community/async-storage

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 4
  • Comments: 17 (2 by maintainers)

Most upvoted comments

The PR #8250 to migrate to the community version of AsyncStorage has just been merged to main. Please refer https://github.com/aws-amplify/amplify-js/issues/6031#issuecomment-837332785 for latest updates on the release.

Kindly ask maintainers to accept the PR. We are frozen on two projects due to the lack of persistent auth.

There is PR open for this already #4027

@Amplifiyer I believe this is the source of the Auth https://github.com/aws-amplify/amplify-js/issues/4260#issuecomment-546551532 bug. Please release an unstable version as it’s a major blocker.

The amplify documentation covers how to set the storage provider for AUTH (https://aws-amplify.github.io/docs/js/authentication#managing-security-tokens) and provides an example with ASYNC storage.

A short term fix for those affected should take that example but import “@react-native-community/async-storage” - there’s no API changes between the old bundled DEP and the new community version.

Very easy and works.

Cheers

@alisherakb you can configure a custom storage. It’s quite easy

Amplify.configure(aws_config);
Auth.configure({
    storage: AmplifyStorage
});

There is PR open for this already #4027