Coding

Setting up react-native-maps on both iOS and Android.

React-native-maps is supposed to be easy to install?

I recently tried to install the react-native-maps by AirBnb, however, try as I might, I kept on running into issues. Finally, after spending a bit of time exploring and finding out, I figured out the the way for Android and iOS.

For iOS:

Please follow this guide: ( A life saver…!! Specially about the npm-update part )

https://gist.github.com/heron2014/e60fa003e9b117ce80d56bb1d5bfe9e0

For Android:

After the basic setup is done and the linking is done with react-native link. I was still getting issues to run the map in my Android device.

I was getting this error in my Dev Console for android :

Warning: Native component for “AIRMap” does not exist android

To fix this, this is what I had to do :

( in the MainActivity.java file: )

import com.airbnb.android.react.maps.MapsPackage;
@Override
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
          new MainReactPackage(),
          new MapsPackage()
      );
    }
  };

And…. Finally!!

react-native-maps running in iOS.

A few other things to keep in mind.

In the Google Developers Console, make sure to tick the application to enable the support for the Google Maps SDK for iOS and basic Google Maps for Android as well. Otherwise, you will get a blank map.

Leave a Reply

Your email address will not be published. Required fields are marked *