Async-storage: RN 0.60.0: [@RNC/AsyncStorage]: NativeModule: AsyncStorage is null

Created on 5 Jul 2019  路  4Comments  路  Source: react-native-async-storage/async-storage

Current behavior

Build Successful, but always got error like below even after I run react-native link @react-native-community/async-storage.

For RN 0.60.0, we do not need to run the link command for native modules, so i get error after I run react-native link ...:

error React Native CLI uses autolinking for native dependencies, but the following modules are linked manually:
  - @react-native-community/async-storage (to unlink run: "react-native unlink @react-native-community/async-storage")

Expected behavior

For RN 0.60.0, we do not need to run the link command for native modules.

Repro steps

Init a project with react-native 0.60.0 ...

Environment

  • Async Storage version: 1.5.0
  • React-Native version: 0.60.0
  • Platform tested: Android
  • Logs/Error that are relevant:
    So what should I do to fix that for 0.60.

Thanks.

bug

Most helpful comment

I ran into the same error AsyncStorage is null error when migrating our test app to RN 0.60.0 today.

I resolved the issue by running react-native unlink @react-native-community/async-storage and cd ios && pod install again.

All 4 comments

Ah, it looks like because the react-native-cli autolinking error: :ReactNative:Automatic import of native modules failed. https://github.com/react-native-community/cli/issues/470

The error tells you to _unlink_ manually linked modules if using autolinking (this module is supported, but the docs are not updated yet), so they don't collide and cause issues in future when upgrading. Can we make it more readable for you?

I ran into the same error AsyncStorage is null error when migrating our test app to RN 0.60.0 today.

I resolved the issue by running react-native unlink @react-native-community/async-storage and cd ios && pod install again.

Hope that unlink fixed it for ya, @Riant . Going to add instructions in the docs for RN 0.60+

Was this page helpful?
0 / 5 - 0 ratings