![](/img/trans.png)
[英]React Native: Tried to register two views with the same name RNCMaskedView
[英]Error: Tried to register two views with the same name AIRMap… while implementing react-native-maps
我使用react-native-maps,这是我的代码:
import { Marker} from 'react-native-maps';
import { MapView} from 'expo';
<MapView
style={{ flex: 1, height: 300 }}
initialRegion={{
latitude: 37.78825,
longitude: -122.4324,
latitudeDelta: 0.0922,
longitudeDelta: 0.0421,
}}>
<Marker
coordinate={{
latitude: 39.78825,
latitude: 39.78825,
}}
title="Title"
description={"Desc"}
/>
</MapView>
它返回错误: “试图注册两个具有相同名称AIRMap的视图”请帮助。 谢谢。
您能否提供依赖项列表,访问Expo.MapView仅需要react-native-maps。 您是否可以安装两个本机的本地地图副本?
当依赖项由于某种原因损坏时,可能会发生这种情况。 尝试删除package-lock.json(或yarn.lock)和node_modules文件夹,然后再次运行npm install(或yarn)。
采用:
import MapView from 'react-native-maps';
确保将此代码添加到android / app / src / main / AndroidManifest.xml
<application>
<!-- You will only need to add this meta-data tag, but make sure it's a child of application -->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="Your Google maps API Key Here"/>
</application>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.