Expo

Documentation

MapView

A Map component that uses Apple Maps or Google Maps on iOS and Google Maps on Android. Expo uses react-native-maps at react-community/react-native-maps. No setup required for use within the Expo app, or within a standalone app for iOS. See below for instructions on how to configure for deployment as a standalone app on Android.
Expo includes version 0.22.0 of react-native-maps (the latest as of the time of this writing).

This API is pre-installed in managed apps. To use it in a bare React Native app, follow the react-native-maps installation instructions.

See full documentation at react-community/react-native-maps.

If you have already integrated Google Sign In into your standalone app, this is very easy. Otherwise, there are some additional steps.
  • If you already have Google Sign In configured
    1. Open your browser to the Google API Manager.
    2. Select your project and enable the Google Maps Android API
    3. In app.json, copy the API key from android.config.googleSignIn to android.config.googleMaps.apiKey.
    4. Rebuild your standalone app.
  • If you already have not configured Google Sign In
    1. Build your app, take note of your Android package name (eg: ca.brentvatne.growlerprowler)
    2. Open your browser to the Google API Manager and create a project.
    3. Once it's created, go to the project and enable the Google Maps Android API
    4. Go back to https://console.developers.google.com/apis/credentials and click Create Credentials, then API Key.
    5. In the modal that popped up, click RESTRICT KEY.
    6. Choose the Android apps radio button under Key restriction.
    7. Click the + Add package name and fingerprint button.
    8. Add your android.package from app.json (eg: ca.brentvatne.growlerprowler) to the Package name field.
    9. Run expo fetch:android:hashes.
    10. Copy Google Certificate Fingerprint from the output from step 9 and insert it in the "SHA-1 certificate fingerprint" field.
    11. Copy the API key (the first text input on the page) into app.json under the android.config.googleMaps.apiKey field. See an example diff.
    12. Press Save and then rebuild the app like in step 1.
Note: The API key can be accessed through your app's Constants (via Constants.manifest.android.config.googleMaps.apiKey) if you'd prefer not to have it in your code directly.
Note: If you've enabled Google Play's app signing service, you will need to grab their app signing certificate in production rather than the upload certificate returned by expo fetch:android:hashes. You can do this by grabbing the signature from Play Console -> Your App -> Release management -> App signing, and then going to the API Dashboard -> Credentials and adding the signature to your existing credential.

Apple Maps should just work with no extra configuration. For Google Maps, you can specify your own Google Maps API key using the ios.config.googleMapsApiKey configuration in your project's app.json. Note: This can also be accessed through your app's Constants (via Constants.manifest.ios.config.googleMapsApiKey) if you'd prefer not to have the API key in your code.

If you want to add MapView with Google Maps to an ExpoKit (ejected) project on iOS, you may need to manually provide a key by calling:
[GMSServices provideApiKey:@"your api key"]
Alternatively, you can provide the GMSApiKey key in your app's Info.plist and ExpoKit will pick it up automatically. If you ejected after already configuring Google Maps, the eject step may have already provided this for you.

Web is experimental! You may need to add the web target to your Expo app.
To use this in web, add the following script to your web/index.html. This script may already be present, if this is the case, just replace the API_KEY with your Google Maps API key which you can obtain here: Google Maps: Get API key
<!DOCTYPE html>
<html lang="en">
  <head>
    <!-- At the end of the <head/> element... -->

    <script
      async
      defer
      src="https://maps.googleapis.com/maps/api/js?key=API_KEY"
      type="text/javascript"
    ></script>

    <!-- Use your web API Key in place of API_KEY: https://developers.google.com/maps/documentation/javascript/get-api-key -->
  </head>

  <!-- <body /> -->
</html>