javascript - Error: Tried to register two views with the same name AIRMap... while implementing react-native-maps - Stack Overfl

I use react-native-maps, here's my code:import { Marker} from 'react-native-maps';impor

I use react-native-maps, here's my code:

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>

It returns error: "Tried to register two views with the same name AIRMap" Please help. Thanks.

I use react-native-maps, here's my code:

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>

It returns error: "Tried to register two views with the same name AIRMap" Please help. Thanks.

Share Improve this question asked Jan 18, 2019 at 3:39 Hendro FebrianHendro Febrian 2221 gold badge3 silver badges13 bronze badges 1
  • Common problem: github./venits/react-native-map-clustering/issues/108 – Bill Zelenko Commented Oct 22, 2019 at 3:36
Add a ment  | 

4 Answers 4

Reset to default 1

This may happen when dependencies are corrupt for some reason. Try deleting your package-lock.json (or yarn.lock) and node_modules folder, then run npm install (or yarn) again.

Could you provide the dependencies list, Accessing Expo.MapView just requires react-native-maps. Could you perhaps have two copies of react-native-maps installed?

Use:

import MapView from 'react-native-maps';

Make sure you add this code to your 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=".google.android.geo.API_KEY"
     android:value="Your Google maps API Key Here"/>
</application>

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745574898a4633902.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信