可能有一些人正在问这个问题,我在Github上找了很久,但找不到安装React Native Maps的解决方案...
不变式违规:requireNativeComponent:“AIRMap”在UIManager中未找到。
此错误位于: 在AIRMap(位于MapView.js的第760行) 在MapView中(位于Home.js的第118行)
"react-native": "^0.57.0-rc.4",
"react-native-maps": "^0.21.0",
我尝试过:
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
按照此指南手动添加 Maps SDK for iOS,无需使用 CocoaPods:https://developers.google.com/maps/documentation/ios-sdk/start
在 AppDelegate.m
中添加 @import GoogleMaps;
和 [GMSServices provideAPIKey:@"_YOUR_API_KEY_"];
仍然遇到相同的错误...
我没有将其添加到 package.json,因为我不确定它要求什么路径?我在这里找到了相关信息: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"
}
}