问题描述
我有一个地图视图,其中渲染了三种类型的标记:访问、书签和喜欢。
<MapView
style={styles.map}
provider={PROVIDER_GOOGLE}
initialRegion={region}
showsUserLocation={true}
ref={mapRef}
>
{/* <View style={{ paddingLeft: '5%',paddingBottom: '1%',height: '18%',width: '100%',flexDirection: 'row',justifyContent: 'flex-start',alignItems: 'flex-end' }}> */}
<View style={{ paddingLeft: '5%',flexDirection: 'column'}}>
<View style={{ flexDirection: 'row',paddingTop: '24%' }}>
{profileUser && followers.length > 0 && <FollowerPicture user={profileUser} /> }
{followers.map(follower => {
return (
<FollowerPicture key={follower.profileUri} user={follower} />
)
})}
</View>
{data && <TouchableOpacity onPress={filter} style={{
shadowColor: '#000000',shadowOffset: {
width: 0,height: 3
},shadowRadius: 5,shadowOpacity: 0.3,alignSelf: 'flex-end',marginTop: '3%',marginRight: '5%',backgroundColor: colors.white1,height: 40,width: 40,borderRadius: 40,justifyContent: 'center',alignItems: 'center'
}}>
<FontAwesome name="filter" size={24} color={colors.black2} />
</TouchableOpacity>}
</View>
{visits.map(visit => {
const restaurant = visit.restaurant;
return(
<MapView.Marker
key={restaurant.id.toString().concat(restaurant.__typename)}
coordinate={{ latitude: restaurant.latitude,longitude: restaurant.longitude }}
title={restaurant.name}
pinColor={colors.green1}
onPress={(e) => {
pressMarker(e,restaurant.id)
}}
/>
)
})}
{bookmarks.map(bookmark => {
const restaurant = bookmark.restaurant;
return(
<MapView.Marker
key={restaurant.id.toString().concat(restaurant.__typename)}
coordinate={{ latitude: restaurant.latitude,longitude: restaurant.longitude }}
title={restaurant.name}
pinColor={colors.blue2}
onPress={(e) => {
pressMarker(e,restaurant.id)
}}
/>
)
})}
{likes.map(like => {
const restaurant = like.restaurant;
return(
<MapView.Marker
key={restaurant.id.toString().concat(restaurant.__typename)}
coordinate={{ latitude: restaurant.latitude,longitude: restaurant.longitude }}
title={restaurant.name}
pinColor={colors.red1}
onPress={(e) => {
pressMarker(e,restaurant.id)
}}
/>
)
})}
</MapView>
但是,在地图中,其他标记也是可见的。这些标记是 Google 地图默认显示的默认标记。地图放大得越多,出现的这些标记就越多。
这就是地图的样子。红色和蓝色标记是我的标记。代表 IHOP、Veselka、Veniero's Pasticceria & Caffe 等的标记是 Google 地图的默认标记。
我的问题有两个:
- 如何选择这些默认的 Google 地图标记?我尝试使用像 onPress 或 onMarkerSelect 这样的 MapView 方法,但是当我点击默认标记时没有事件触发器。
- 如何删除这些默认的 Google 地图标记?
非常感谢!!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)