I am working on a React-Native
app using Expo
, and I am trying to integrate Google Maps
on the home screen. However, the map does not load and only shows a blank white screen. Here’s the relevant code and configuration:
import React from 'react';
import { StyleSheet } from 'react-native';
import MapView, { Marker, PROVIDER_GOOGLE } from 'react-native-maps';
export default function HomeScreen() {
return (
<MapView
provider={PROVIDER_GOOGLE}
style={StyleSheet.absoluteFill}
initialRegion={{
latitude: 41.0082,
longitude: 28.9784,
latitudeDelta: 0.0922,
longitudeDelta: 0.0421,
}}
>
<Marker coordinate={{ latitude: 41.0082, longitude: 28.9784 }} />
</MapView>
);
}
app.json configuration
"ios": {
"googleServicesFile": "./GoogleService-Info.plist",
"supportsTablet": true,
"bundleIdentifier": "com.xxx.xxx.xxx",
"config": {
"googleMapsApiKey": "XXX"
}
},
Steps I have taken
- I added the
googleMapsApiKey
under theios.config
section in app.json. - I ensured the
PROVIDER_GOOGLE
is used in the MapView. - The app has permissions for location access.
- I verified the API Key is enabled for Google Maps SDK for iOS in the Google Cloud Console.
Despite these steps, the map screen remains blank.
What I have tried
- Confirmed that the
googleMapsApiKey
is valid and has no restrictions. - Checked that the
Google Maps SDK
for iOS is enabled in theGoogle Cloud Console
. - Cleaned the Expo cache with
expo start -c
. - Rebuilt the app and tested on a physical device as well as on the iOS simulator.
Questions
- Am I missing any configuration for Google Maps with Expo on iOS?
- Do I need to include any additional native dependencies or steps since I’m using Expo?
- Could there be an issue with how Expo handles the googleMapsApiKey or permissions?
I was facing the same issue when i updated my expo from 50
to 52
and on my side the bug got resolved when I changed the provider from PROVIDER_GOOGLE
to PROVIDER_DEFAULT
.
Solution
So just import PROVIDER_DEFAULT
and use PROVIDER_DEFAULT
instead of PROVIDER_GOOGLE
.
<MapView provider={PROVIDER_DEFAULT}>
...
</MapView>
Version
"expo": "^52.0.18",
"react-native": "0.76.5",
"react-native-maps": "1.18.0",
3