“AIRMap"的原生组件不存在 [英] Native component for "AIRMap" does not exist

查看:60
本文介绍了“AIRMap"的原生组件不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

react-native: 0.53.3react-native-maps@0.20.1

我正在尝试使用

解决方案

就我而言,按照说明操作后得到了相同的结果,最后的解决方案非常简单.

我去了 Xcode -> Clean -> Build.

<块引用>

在那里我看到我的代码中有 2 个错误:

  1. 预期的';'在模块名称之后 (@import GoogleMaps)

  2. 使用未声明的标识符 ([GMSPlacesClient provideAPIKey:@"MY_KEY"];)

所以,我添加了';'并删除了行 GMSPlacesClient provideAPIKey:@"MY_KEY"];

之后我再次执行'npm run ios',一切都像魅力一样!

这里还有其他解决方案:

  1. https://github.com/react-社区/react-native-maps/issues/1798

  2. https://github.com/react-社区/react-native-maps/issues/2064

react-native: 0.53.3
react-native-maps@0.20.1

I'm trying to use react-native-maps and I keep getting this error. This is in a fresh project:

react-native init maps
cd maps/
npm install --save react-native-maps
react-native run-ios

And in App.js I've added this:

...
import MapView from 'react-native-maps';

export default class App extends Component<Props> {
  render() {
    return (
      <View>
      <MapView
      initialRegion={{
        latitude: 37.78825,
        longitude: -122.4324,
        latitudeDelta: 0.0922,
        longitudeDelta: 0.0421,
      }}
    />
    </View>
    );
  }
}

This seems to be the bare minimum to get this running, but my iOS simulator is complaining about "AIRMap".

解决方案

In my case I had the same result after following the instructions and the solution at the end was really simple.

I went to Xcode -> Clean -> Build.

There I saw that I had 2 errors in my code:

  1. Expected ';' after module name (@import GoogleMaps)

  2. Use of undeclared identifier ([GMSPlacesClient provideAPIKey:@"MY_KEY"];)

So, I added ';' and deleted the line GMSPlacesClient provideAPIKey:@"MY_KEY"];

After that I executed again 'npm run ios' and all worked like a charm!

There are other solutions here:

  1. https://github.com/react-community/react-native-maps/issues/1798

  2. https://github.com/react-community/react-native-maps/issues/2064

这篇关于“AIRMap"的原生组件不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆