⚠️ This package cannot be used in the "Expo Go" app because it requires custom native code.
First install the package with expo
, yarn
or npm
.
Install the latest release:
expo install @rnmapbox/maps
After installing this package, add the config plugin to the plugins
array of your app.{json,config.js,config.ts}
:
{
"expo": {
"plugins": [
[
"@rnmapbox/maps",
{
"RNMapboxMapsVersion": "11.8.0"
}
]
]
}
}
You'll need to provide RNMapboxMapsDownloadToken
as well. This secret token requires the DOWNLOADS:READ
scope. You can refer to the iOS guide, which explains how to configure this token under the section Configure your secret token
.
{
"expo": {
"plugins": [
[
"@rnmapbox/maps",
{
"RNMapboxMapsDownloadToken": "sk.ey...qg"
}
]
]
}
}
If you want to show the user's current location on the map with the UserLocation component, you can use the expo-location plugin to configure the required NSLocationWhenInUseUsageDescription
property. Install the plugin with npx expo install expo-location
and add its config plugin to the plugins array of your app.{json,config.js,config.ts}
:
{
"expo": {
"plugins": [
[
"expo-location",
{
"locationWhenInUsePermission": "Show current location on map."
}
]
]
}
}
Next, rebuild your app as described in the "Adding custom native code" guide.
It's possible to overwrite the native SDK version with RNMapboxMapsVersion
:
{
"expo": {
"plugins": [
[
"@rnmapbox/maps",
{
"RNMapboxMapsVersion": "10.16.2",
"RNMapboxMapsDownloadToken": "sk.ey...qg"
}
]
]
}
}
To use V11 just set the version to a 11 version, see the ios guide:
{
"expo": {
"plugins": [
[
"@rnmapbox/maps",
{
"RNMapboxMapsVersion": "11.8.0",
"RNMapboxMapsDownloadToken": "sk.ey...qg",
}
]
]
}
}
For bare workflow projects, you can follow the manual setup guides: