Create a React Native app
This guide walks you through creating a React Native project and running it on Android or iOS.
Create a project
npx @react-native-community/cli@latest init hello_world
Install Magic Lane dependencies
Add the Maps SDK packages:
cd hello_world
npm install @magiclane/maps-sdk @magiclane/maps-sdk-react-native
If you prefer editing package.json manually, add:
"dependencies": {
"@magiclane/maps-sdk-react-native": "0.1.0"
}
Then run:
npm install
Build on Android
cd hello_world
npx react-native run-android
If you see an Android SDK error, ensure ANDROID_HOME is set and add a local SDK path in android/local.properties:
sdk.dir=/path/to/your/android/sdk
Replace /path/to/your/android/sdk with the actual path to your Android SDK.
Build on iOS
cd hello_world
npx react-native run-ios
Make sure Xcode is installed and you have permission to run the iOS simulator.
Add the Hello World map
Replace your App.tsx with the React Native Hello World example:
That example shows how to initialize the SDK and render a map using GLView.