This guide covers configuring react-native-better-maps in an Expo app with the New Architecture enabled.
- Expo SDK 56+ (verified through SDK 57)
- React Native 0.78+ with the New Architecture enabled (the default since Expo SDK 53; SDK 57 removed the
newArchEnabledconfig property because the New Architecture is the only option) react-native-nitro-modulesinstalled alongsidereact-native-better-maps
| Expo SDK | React Native | Status |
|---|---|---|
| 57 | 0.86 | Verified |
| 56 | 0.85 | Verified |
bun add react-native-better-maps react-native-nitro-modulesAdd the plugin to app.json or app.config.js:
/** @type {import('expo/config').ExpoConfig} */
module.exports = {
expo: {
// ...your existing config
plugins: [
[
'react-native-better-maps',
{
googleMapsApiKey: process.env.GOOGLE_MAPS_API_KEY,
locationPermission:
'Allow $(PRODUCT_NAME) to use your location for map features.',
},
],
],
},
};| Option | Type | Default | Description |
|---|---|---|---|
googleMapsApiKey |
string |
— | Shared fallback for iOS and Android when platform-specific keys are omitted. |
iosGoogleMapsApiKey |
string |
— | Injects GoogleMapsIosApiKey into Info.plist and sets betterMaps.iosGoogleProvider in Podfile.properties.json so the Google Maps SDK is linked on iOS. |
androidGoogleMapsApiKey |
string |
— | Injects com.google.android.geo.API_KEY meta-data on Android. |
locationPermission |
string | false |
— | Foreground location message. Injects iOS NSLocationWhenInUseUsageDescription plus Android ACCESS_FINE_LOCATION and ACCESS_COARSE_LOCATION. |
locationAlwaysPermission |
string | false |
— | Background location message. Injects iOS NSLocationAlwaysAndWhenInUseUsageDescription plus Android ACCESS_BACKGROUND_LOCATION; also supplies foreground usage strings and permissions when locationPermission is omitted. |
Omitting Google Maps keys does not fail prebuild. iOS MapKit works without a key, but the iOS and Android Google Maps providers require their platform keys before they can render.
Create a .env file (see example/.env.example):
GOOGLE_MAPS_API_KEY=your-google-maps-api-keyLoad it in app.config.js with process.env.GOOGLE_MAPS_API_KEY as shown above.
Store the key as an EAS secret:
eas secret:create --name GOOGLE_MAPS_API_KEY --value your-google-maps-api-keyReference it in app.config.js via process.env.GOOGLE_MAPS_API_KEY. EAS injects secrets into the build environment automatically.
You can use Expo's native android.config.googleMaps.apiKey instead of the plugin's googleMapsApiKey. Pick one source — do not configure both.
Generate native projects:
expo prebuild --cleanThe plugin injects:
- Android:
com.google.android.geo.API_KEYmeta-data (whengoogleMapsApiKeyorandroidGoogleMapsApiKeyis set) and location permissions (when location options are set) - iOS:
GoogleMapsIosApiKeyinInfo.plistandbetterMaps.iosGoogleProviderinPodfile.properties.json(whengoogleMapsApiKeyoriosGoogleMapsApiKeyis set), plus location usage description strings (when location options are set)
On iOS, the API key and pod linkage are separate artifacts. The plugin keeps them in sync during prebuild. If you later remove Google Maps keys from the plugin config, re-run expo prebuild to remove both GoogleMapsIosApiKey and betterMaps.iosGoogleProvider, then run pod install to update the linked pods. Bare React Native apps without the plugin must manage both settings manually; see Bare React Native in the README.
expo run:android
expo run:iosThe monorepo example at example/ uses this plugin. From the repo root:
GOOGLE_MAPS_API_KEY=your-key bun example prebuild
GOOGLE_MAPS_API_KEY=your-key bun example androidThe example's prebuild script builds the plugin (build:plugin) before running expo prebuild, since the workspace symlink requires compiled plugin output.
| Symptom | Fix |
|---|---|
| Blank Google map | Ensure googleMapsApiKey or the platform-specific Google Maps key is set, then run expo prebuild again. |
| iOS Google Maps key present but provider fails | iOS needs GoogleMapsIosApiKey in Info.plist and "betterMaps.iosGoogleProvider": "true" in Podfile.properties.json, then pod install. Re-run prebuild after changing or removing plugin keys so both artifacts stay aligned. |
| Location dot not showing | Set locationPermission or locationAlwaysPermission in the plugin options and re-run prebuild. |
| Plugin not found | Confirm react-native-better-maps is installed and listed in plugins. |
Cannot find module './plugin/build/index' |
Run bun run build:plugin in the package (or bun run build from the repo root) before prebuild when using a workspace link. |