<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Dassine B on Medium]]></title>
        <description><![CDATA[Stories by Dassine B on Medium]]></description>
        <link>https://medium.com/@dassineb?source=rss-2624b5095083------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*Kj7OsZ0KEOdEzi2c.</url>
            <title>Stories by Dassine B on Medium</title>
            <link>https://medium.com/@dassineb?source=rss-2624b5095083------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 15 Nov 2026 12:12:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dassineb/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Integrate Maps and Google in React Native using react-native-maps]]></title>
            <link>https://medium.com/@dassineb/integrate-maps-and-google-in-react-native-using-react-native-maps-97ed5e80617c?source=rss-2624b5095083------2</link>
            <guid isPermaLink="false">https://medium.com/p/97ed5e80617c</guid>
            <category><![CDATA[react-native-maps]]></category>
            <category><![CDATA[apple-maps]]></category>
            <category><![CDATA[google-maps]]></category>
            <category><![CDATA[react-native]]></category>
            <dc:creator><![CDATA[Dassine B]]></dc:creator>
            <pubDate>Wed, 04 Sep 2019 22:55:12 GMT</pubDate>
            <atom:updated>2019-09-04T22:55:12.032Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Integrate Maps and Google in React Native using react-native-maps</strong></p><p>When it’s time to integrate a maps in your React Native app, you would see there is some tutorials that might give you some hard time to implement. Let’s try to build a simple map app step by step with less confusion possible.</p><p><strong>Step 1 — Create your RN project</strong></p><p>Let’s start by creating a React Native application from scratch using <strong>react-native-cli</strong> (If you just want to integrate <a href="https://www.npmjs.com/package/react-native-maps"><strong>react-native-maps</strong></a> for your existing app, please skip this step).</p><p>If it happens that you don’t have already installed React Native Command Line Interface, go ahead and run:</p><p><strong>npm install -g react-native-cli</strong></p><p>Once React Native Command Line Interface installed, you can create your project by running:</p><p><strong>react-native init MyRNMapProject</strong></p><p>To try your app on the iOS Simulator, please run:</p><p><strong>react-native run-ios</strong></p><p>To run the app on Android, you need to make sure to have the Emulator already open. To do so, you will need to run the app through Android Studio (by dragging dropping <strong>MyRNMapProject/Android</strong> folder and click on the run button once it’s compiled). Once the Emulator opens up you would be able to use:</p><p><strong>react-native run-android</strong></p><p>The app should look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/0*3h7xY-c_IckpqHw3" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/0*i1hxD5E55CHdg7oU" /></figure><p><strong>Step 2 — Integrate the react-native-maps</strong></p><p>To do so, we will use react-native-maps. Let’s add it to our project using this command:</p><p><strong>npm add react-native-maps</strong></p><p>Adding <strong>react-native-maps</strong> requires to link the library by using:</p><p><strong>react-native link react-native-maps</strong></p><p>It also requires to run<strong> pod install </strong>under<strong> ./ios </strong>folder</p><p>If you miss this last step you will hit this error:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/0*SrzFYK18Af3wBrmk" /></figure><p><strong>Step 3 — Display iOS Maps</strong></p><p>As you know it’s possible to display a map on iOS using the native Apple Maps or Google Maps. We will start by integrating the Apple Maps. Please, skip this step if your aim is to have an app working on iOS and Android, it’s better to integrate the Google one.</p><p>Let’s render the maps in <strong>App.js</strong>. You will need to import the component MapView from react-native-maps to be able to render the <strong>MapView</strong> component. In this example, Facebook HQ geocoordinate are used, feel free to set the coordinate that you want.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/0*52_tp3dp7HS6MKXp" /></figure><p>Once done, you can run the app again and you will be prompted to allow the app to access location before to display the Facebook HQ. Success!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/0*FzbvdvMsjoQWbgYE" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/676/0*ysvATKEhxR0bVtPa" /></figure><p><strong>Step 4 — Create your Google Maps Api Key</strong></p><p>In order to use Google Maps in your app (iOS and Android), you will need to subscribe your App on <a href="https://cloud.google.com/">Google Cloud Platform</a>. Google Apis will act as your Back-End Apis</p><p>To get the Google Maps Api Key, you will need to create your app project. Please follow <a href="https://developers.google.com/maps/documentation/ios-sdk/get-api-key">these steps</a>. The Api key should look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EauKcxVdFnCLVZeR" /></figure><p>You will also need to <strong>enable</strong> the <a href="https://console.cloud.google.com/google/maps-apis/apis/maps-ios-backend.googleapis.com">Maps SDK for iOS</a> and <a href="https://console.cloud.google.com/apis/library/maps-android-backend.googleapis.com">Maps SDK for Android</a> in your new project.</p><p><strong>Step 5 — Display Google Maps on iOS</strong></p><p>iOS provides Apple Maps by default. To use Google Maps, you will need to add <strong>Google Maps pod</strong> (provided by <a href="https://cocoapods.org/pods/GoogleMaps">cocoapods</a>) to your <strong>Podfile</strong> that can be found under <strong>./ios</strong>:</p><p><strong>pod ‘GoogleMap’</strong></p><p>Once added, you should run pod install on your terminal under <strong>./ios</strong>:</p><p><strong>$ pod install</strong></p><p>Once the pod installed, some settings need to be done on your iOS Project. First open your project .<strong>xcworkspace</strong> project that can be found under<strong> ./ios.</strong></p><p>As mentioned in <a href="https://www.npmjs.com/package/react-native-maps">react-native-maps package installation</a>, you will also need to drag and drop the library folder <strong>./node_modules/react-native-maps/lib/ios/AirGoogleMaps</strong> to your project by making sure the <strong>Copy items if needed</strong> and<strong> Create groups</strong> are set:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Iv49ptwaPCONIit5" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_DUffdrlgyC1IoHX" /></figure><p>One last setting still needs to be added! Under <strong>Preprocessor Macro </strong>in you iOS Project <strong>Build Settings</strong>, please add<strong> HAVE_GOOGLE_MAPS=1 </strong>flag<strong>:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*u1989ar1J_Vcw0iB" /></figure><p>Then, you will be able to complete the integration by referencing you<strong> Google Api Key</strong> in <strong>./ios/AppDelegate.m </strong>file. See bold lines:</p><p>#import “AppDelegate.h”</p><p>#import &lt;React/RCTBridge.h&gt;</p><p>#import &lt;React/RCTBundleURLProvider.h&gt;</p><p>#import &lt;React/RCTRootView.h&gt;</p><p><strong>#import &lt;GoogleMaps/GoogleMaps.h&gt;</strong></p><p>@implementation AppDelegate</p><p>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions</p><p>{</p><p><strong>[GMSServices provideAPIKey:@”AIzaSyDn3MZrAy-qcxmLvPmO40H7OBPRNZI2E0I”];</strong></p><p>RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];</p><p>RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge</p><p>moduleName:@”RecycleMTL”</p><p>initialProperties:nil];</p><p>rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];</p><p>self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];</p><p>UIViewController *rootViewController = [UIViewController new];</p><p>rootViewController.view = rootView;</p><p>self.window.rootViewController = rootViewController;</p><p>[self.window makeKeyAndVisible];</p><p>return YES;</p><p>}</p><p>To display the Google Maps your will need to alter you <strong>MapView</strong> element in your <strong>App.js</strong> and set the provider as a PROVIDER_GOOGLE, <strong>provider={PROVIDER_GOOGLE}, </strong>after importing it from <strong>react-native-maps</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*T0KvOkQAbyIvMD3V" /></figure><p><strong>Step 6 — Display Google Maps on Android</strong></p><p>Google Maps integration for the Android app is pretty simple! You will just need to reference your <strong>Google</strong> <strong>Api Key</strong> in the<strong> ./android/app/main/AndroidManifest.xml</strong></p><p>&lt;manifest xmlns:android=”http://schemas.android.com/apk/res/android&quot;</p><p>package=”com.myrnmapproject”&gt;</p><p>&lt;uses-permission android:name=”android.permission.INTERNET” /&gt;</p><p>&lt;application</p><p>android:name=”.MainApplication”</p><p>android:label=”@string/app_name”</p><p>android:icon=”@mipmap/ic_launcher”</p><p>android:roundIcon=”@mipmap/ic_launcher_round”</p><p>android:allowBackup=”false”</p><p>android:theme=”@style/AppTheme”&gt;</p><p>&lt;activity</p><p>android:name=”.MainActivity”</p><p>android:label=”@string/app_name”</p><p>android:configChanges=”keyboard|keyboardHidden|orientation|screenSize”</p><p>android:windowSoftInputMode=”adjustResize”&gt;</p><p>&lt;intent-filter&gt;</p><p>&lt;action android:name=”android.intent.action.MAIN” /&gt;</p><p>&lt;category android:name=”android.intent.category.LAUNCHER” /&gt;</p><p>&lt;/intent-filter&gt;</p><p>&lt;/activity&gt;</p><p>&lt;activity android:name=”com.facebook.react.devsupport.DevSettingsActivity” /&gt;</p><p><strong>&lt;meta-data</strong></p><p><strong>android:name=”com.google.android.geo.API_KEY”</strong></p><p><strong>android:value=”AIzaSyDn3MZrAy-qcxmLvPmO40H7OBPRNZI2E0I”</strong></p><p><strong>/&gt;</strong></p><p>&lt;/application&gt;</p><p>&lt;/manifest&gt;</p><p>Run you app (react-native run-ios and react-native run-android) on both simulator and emulator, the Google Maps will be displayed centered on Facebook HQ:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/0*srUqpL3wmQPmNF05" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/0*rNCilWX6uRhS9f8s" /></figure><p>Et voilà!</p><p>Hope this tutorial was helpful. All the source code is available <a href="https://github.com/Dassine/react-native-maps-integration">here</a>. Keep up the good work!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=97ed5e80617c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>