Reference for the Magic SDK for React Native: https://github.com/magiclabs/magic-js
APIs from Magic SDK for Web are also available in the React Native bundle.
Magic can support either server-based or serverless web applications. It is up to the developers to implement the Admin SDK to validate the DID Token.
Create an SDK Instance
Examples for the Magic Client SDK for React Native uses the ES Module/TypeScript pattern by default.
- ES Modules/TypeScript
To facilitate events between the Magic
<iframe> context and your React Native application, a React component is exposed on your Magic instance:
<Relayer> must be rendered into your application before Magic methods will resolve.
Usage With Ethereum/Web3
As with our web SDK, the React Native SDK can be used with Ethereum via Web3 or Ethers JS.
There's one "gotcha" to be aware of:
@magic-sdk/react-native must be imported before
web3 (this restriction does not apply to ethers). For example:
Set up web3.js
If you encounter this error:
"Crypto" could not be found within the project
Then, create a file called
metro.config.js at the root of the project: