Show your first map
Start with an Expo app and a MapQuest API key. You'll run the map on an iOS simulator or Android emulator using a native build. Expo Go doesn't include the SDK's native modules.
Install the SDK
From your app directory, run:
npm install @mapquest/sdkConfigure the Expo plugin
Add the plugin to the existing expo.plugins array in app.json, replacing the placeholder with your MapQuest API key:
{
"expo": {
"plugins": [
["@mapquest/sdk", { "apiKey": "YOUR_MAPQUEST_API_KEY" }]
]
}
}If you use app.config.ts instead, add the same plugin with the typed helper:
import { withMapQuest } from '@mapquest/sdk/plugin'
export default {
plugins: [
// Keep your existing plugins here.
withMapQuest({ apiKey: 'YOUR_MAPQUEST_API_KEY' }),
],
}Render the map
Use this component as a screen in your app. With Expo Router, you can use it as the default export of a route:
import { Map } from '@mapquest/sdk'
export default function MapScreen() {
return <Map style={{ flex: 1 }} />
}Build and run
Run the command for your platform:
npx expo run:ios
# or
npx expo run:androidOpen the map screen. The map should fill the screen without prompting for location permission.