magic-js icon indicating copy to clipboard operation
magic-js copied to clipboard

Error: [@RNC/AsyncStorage]: NativeModule: AsyncStorage is null.

Open kb-codes opened this issue 2 years ago • 10 comments

✅ Prerequisites

  • [x] Did you perform a cursory search of open issues? Is this bug already reported elsewhere?
  • [x] Are you running the latest SDK version?
  • [x] Are you reporting to the correct repository (magic-sdk)?

🐛 Description

Error: [@RNC/AsyncStorage]: NativeModule: AsyncStorage is null.

To fix this issue try these steps:

• Rebuild and restart the app.

• Run the packager with --reset-cache flag.

• If you are using CocoaPods on iOS, run pod install in the ios directory and then rebuild and re-run the app.

• If this happens while testing with Jest, check out docs how to integrate AsyncStorage with it: https://react-native-async-storage.github.io/async-storage/docs/advanced/jest

If none of these fix the issue, please open an issue on the Github repository: https://github.com/react-native-async-storage/async-storage/issues , js engine: hermes

🧩 Steps to I follow to install package in React Native

  1. npm install --save @magic-sdk/react-native
  2. npm install --save react-native-webview

💻 Code Sample

const { Magic } = require('@magic-sdk/react-native');

const m = new Magic('API_KEY'); // ✨

const onSubmit = async () => {
        await m.auth.loginWithEmailOTP({ email: '[email protected]' }).then((res) => { console.log(res); })
}

🌎 Environment

Software Version(s)
Operating System Android

kb-codes avatar Sep 22 '22 10:09 kb-codes

Hello @kb-codes Thank you for submitting this issue. Would you please share which Magic SDK and version you are using? Also, have you already tried the steps included to resolve the issue? Was this app created with Expo CLI?

am-hernandez avatar Sep 22 '22 14:09 am-hernandez

Hello, Thanks for the quick replay I'm using magic-sdk/react-native and the version is 10.0.1 for React Native.

And this app was created with React Native CLI

kb-codes avatar Sep 22 '22 16:09 kb-codes

Please solve this ASAP, I was stuck at work because of this.

kb-codes avatar Sep 23 '22 13:09 kb-codes

@kb-codes Could you give us the steps to reproduce the error?

am-hernandez avatar Sep 23 '22 14:09 am-hernandez

Here you go,

  1. Create a project with this command - npx react-native init AwesomeProject
  2. npm install --save @magic-sdk/react-native
  3. npm install --save react-native-webview
  4. npx react-native run-android
  5. In App.js file:
const { Magic } = require('@magic-sdk/react-native');

const m = new Magic('API_KEY'); // ✨

const onSubmit = async () => {
        await m.auth.loginWithEmailOTP({ email: '[email protected]' }).then((res) => { console.log(res); })
}

const App ()=>{
        return(
                 <TouchableOpacity onPress={onSubmit}><Text>Login</Text></TouchableOpacity>
        )
}

kb-codes avatar Sep 23 '22 14:09 kb-codes

Hello, @am-hernandez, Any updates ?

kb-codes avatar Sep 25 '22 06:09 kb-codes

Hello, @am-hernandez, Please update me with a solution, I'm waiting for the production.

kb-codes avatar Sep 27 '22 16:09 kb-codes

Hi @kb-codes sorry for the delay in response. I wasn't able to replicate this issue so I asked for some more eyes on this from our Mobile team. Please give us more time to look into this and follow up here. Thank you!

am-hernandez avatar Oct 03 '22 13:10 am-hernandez

@kb-codes have you ever managed to fix this ? having the exact same issue.

agonist avatar Aug 02 '23 02:08 agonist

@agonist @kb-codes

We have since updated our SDKs and this may no longer be an issue with later versions. If you are able to reproduce the issue with these new SDKs please let us know.

Here are the new SDKs for Magic React Native:

  • @magic-sdk/react-native-bare
  • @magic-sdk/react-native-expo

Please let us know if you are able to reproduce this issue with either of the two SDKs listed above. Thank you!

am-hernandez avatar Aug 02 '23 13:08 am-hernandez