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

Android getItem() doesn't return anything and app becomes unresponsive (RN 0.66.1) #694

Closed
1 of 5 tasks
ricardonazario opened this issue Oct 21, 2021 · 8 comments
Closed
1 of 5 tasks
Assignees
Labels
bug Something isn't working Stale

Comments

@ricardonazario
Copy link

ricardonazario commented Oct 21, 2021

What happened?

I just upgraded to RN 0.66.1 and react-native-async-storage 1.15.9. Everything seems good on iOS but app is hanging on android whenever i call getItem.

Version

1.15.9

What platforms are you seeing this issue on?

  • Android
  • iOS
  • macOS
  • Windows
  • web

System Information

System:
    OS: macOS 11.2.3
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 608.50 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.17.6 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.15 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.11.2 - /Users/ricardonazario/.rvm/rubies/ruby-2.7.2/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4
    Android SDK:
      API Levels: 26, 27, 28, 29, 30
      Build Tools: 28.0.3, 29.0.2, 29.0.3, 30.0.0, 30.0.2
      System Images: android-27 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 3.6 AI-192.7142.36.36.6241897
    Xcode: 12.5.1/12E507 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.6 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2 
    react-native: 0.66.1 => 0.66.1 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps to Reproduce

async getSomething() {
    try {
           console.log('get item');
           const storageItem = await AsyncStorage.getItem('storageItem');
           console.log('GOT ITEM');
      catch (error) {
           console.log(error);
       }
}

If i run the above function, it logs 'get item' but then doesn't log 'GOT ITEM' or the error. Just hangs.

I tried downgrading react-native-async-storage and the issue persists.

@ricardonazario ricardonazario added the bug Something isn't working label Oct 21, 2021
@krizzu krizzu self-assigned this Oct 24, 2021
@krizzu
Copy link
Member

krizzu commented Oct 24, 2021

Hey @ricardonazario
I just tried AsyncStorage (v.1.15.9) with RN 0.66.1 and I could not reproduce issue, both on old storage and next storage. Could it be replated to this issue with large data being retrieved?

@ricardonazario
Copy link
Author

@krizzu Thanks for checking

It may be related at some level but all the values in my async storage are either timestamp strings or boolean strings, so not actually large.

@andyecker
Copy link

This sounds similar to what was blocking us and we finally found the culprit. We are still not sure what the exact issue is, but what "fixes" it for now.

React-native enabled this by default recently:
https://reactnative.dev/blog/2021/03/12/version-0.64#inline-requires-enabled-by-default

metro.config.js file change:
inlineRequires: false

@ricardonazario
Copy link
Author

ricardonazario commented Oct 28, 2021

I was able to solve the issue for my app. I may have been one of two things.

  1. if you want to use Reanimated 2 then go through our installation steps
    I followed the steps and now async storage works. Not sure what this means for react-native-async-storage as a whole.

  2. I realized I had a storybook config file with a condition to fallback on react-native's deprecated asyncstorage if this react-native-async-storage wasn't found. Not sure what it was doing there, but removed that. This file should not have effected the code that was causing me trouble, it was definitely importing the right asyncstorage there.

@andyhmi my app already had inlineRequires: false

@dilshodhamrayev
Copy link

I removed the package "react-combine-reducers" from my app and the issue was solved.

@github-actions
Copy link

This issue has been marked as stale due to inactivity. Please respond or otherwise resolve the issue within 7 days or it will be closed.

@github-actions github-actions bot added the Stale label Jan 30, 2022
@tido64 tido64 closed this as completed Jan 31, 2022
@MichDreby
Copy link

MichDreby commented Jun 16, 2022

The same issue for me. During upgrading react-native to 0.68 (fabric, new architecture) I have to set up inlineRequires: true in the metro config or android build will not work. Right now AsyncStorage.getItem just hangs on.
Help needed.
@krizzu , @tido64

@marouane-edghoughi
Copy link

@MichDreby Did you manage to solve this issue? I'm still facing it in 2023 :D

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

No branches or pull requests

7 participants