This repository contains two mobile applications demonstrating Magic's React Native SDKs and extensions for both Bare React Native and Expo managed workflows.
-
Get Magic API Keys: Sign up or login to the developer dashboard to receive API keys.
-
Clone the Repository:
# SSH
$ git clone [email protected]:magiclabs/react-native-demo.git
# HTTPS
$ git clone https://github.com/magiclabs/react-native-demo.git
- Configure API Keys: Update the Magic publishable API key in both projects:
- Bare React Native Example:
MagicBareRnExample/hooks/magic.ts
- Expo Example:
MagicExpoRNExample/hooks/magic.ts
Replace 'YOUR_PUBLISHABLE_KEY'
with your actual Magic publishable API key.
The Expo example uses Expo Router for navigation and includes modern React Native features.
$ cd MagicExpoRNExample
$ yarn install
$ yarn start
When the bundler starts:
- Press i to open iOS simulator
- Press a to open Android emulator
- Press w to open in web browser
The Bare React Native example provides full native control and custom configurations.
$ cd MagicBareRNExample
$ yarn install
$ cd ios
$ pod install
$ cd ..
$ yarn ios
$ yarn android
If you encounter Error code 65
when running yarn ios
:
-
Clean Build: Follow these steps to clean your iOS build.
-
Update AppDelegate: If updating React Native versions, manually update the
AppDelegate.mm
file in Xcode as suggested here.
If you encounter issues with pod install
:
$ cd ios
$ pod install
Clear Metro cache if you encounter bundling issues:
$ yarn start --reset-cache
This project is licensed under the MIT License.