It might have been a few people asking this question, I have been looking all over Github, but can't find a solution that works for installing React Native Maps...
Invariant Violation: requireNativeComponent: "AIRMap" was not found in the UIManager.
This error is located at: in AIRMap (at MapView.js:760) in MapView (at Home.js:118)
"react-native": "^0.57.0-rc.4",
"react-native-maps": "^0.21.0",
I have tried:
rm -rf ios android node_modules
npm install
react-native upgrade
react-native link
libAirMaps.a is added in Build Phases
AirGoogleMaps and AirMaps is added to Libraries
Followed this guide to add Maps SDK for iOS manually without CocoaPods: https://developers.google.com/maps/documentation/ios-sdk/start
Added @import GoogleMaps;
and [GMSServices provideAPIKey:@"_YOUR_API_KEY_"];
to AppDelegate.m
Still getting the same error...
I have not added this to package.json, as I am unsure what path it is asking for? I found this at https://github.com/react-community/react-native-maps/blob/master/docs/installation.md
{
"name": "your-app",
"scripts": {
"postinstall": "./node_modules/react-native-maps/enable-google-maps REPLACE_ME_RELATIVE_PATH_TO_GOOGLE_MAPS_INSTALL"
}
}
React Native Google Map. Google map is used to locate an address, navigate, and search location in the mobile devices. The Google Maps shows the location (latitude and longitude) using dot Marker. In the react-native, Google Maps is easily integrated using react-native-maps npm library.
react-native-maps provides a Map component that uses Apple Maps or Google Maps on iOS and Google Maps on Android. Expo uses react-native-maps at react-native-maps/react-native-maps. No setup required for use within the Expo Go app.
Go to the Google Maps Platform > Credentials page. On the Credentials page, click Create credentials > API key. The API key created dialog displays your newly created API key. Click Close.
If you follow the Google Map doc and install the SDK manually, you may have add those three frameworks to your project, just right click the framework in Xcode and then Show in Finder, you can find the framework file in finder
and in my case , the REPLACE_ME_RELATIVE_PATH_TO_GOOGLE_MAPS_INSTALL
refers to my ios directory, the related path is ./ios
, just add this to the package.json
file and run
npm install
{
"name": "your-app",
"scripts": {
"postinstall": "./node_modules/react-native-maps/enable-google-maps ./ios"
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With