magiclabs / magic-js

Magic browser/React Native JavaScript SDK is your entry-point to integrating passwordless authentication inside your application.
https://magic.link/docs/api-reference/client-side-sdks/web
Apache License 2.0
463 stars 86 forks source link

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

Open kb-codes opened 2 years ago

kb-codes commented 2 years ago

✅ Prerequisites

🐛 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: 'sample@mail.com' }).then((res) => { console.log(res); })
}

🌎 Environment

Software Version(s)
Operating System Android
am-hernandez commented 2 years ago

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?

kb-codes commented 2 years ago

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 commented 2 years ago

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

am-hernandez commented 2 years ago

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

kb-codes commented 2 years ago

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: 'sample@mail.com' }).then((res) => { console.log(res); }) }

const App ()=>{ return(

Login
    )

}

kb-codes commented 2 years ago

Hello, @am-hernandez, Any updates ?

kb-codes commented 2 years ago

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

am-hernandez commented 2 years ago

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!

agonist commented 1 year ago

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

am-hernandez commented 1 year ago

@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:

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