简体   繁体   English

MapView - 反应原生地图

[英]MapView - react-native-maps

I'm implementing my custom marker pin in MapView component.我正在 MapView 组件中实现我的自定义标记图钉。 Are there a way to hide or remove third party markers, like hotels, restaurants, sales stores, etc...?有没有办法隐藏或删除第三方标记,如酒店、餐馆、销售商店等......?

I have searched in component docs but found nothing.我在组件文档中进行了搜索,但一无所获。

As far as I know, there is at least one way to turn off the business texts and markers.据我所知,至少有一种方法可以关闭商务文本和标记。 It is when we are giving a style to <MapView>当我们给<MapView>一个样式的时候

From this site, https://mapstyle.withgoogle.com/ , skip to styling selecting "use the Legacy JSON styling wizard", Then select "more options" for a more specific styling.从此站点https://mapstyle.withgoogle.com/跳至样式选择“使用旧版 JSON 样式向导”,然后选择 select 样式以获取更多特定样式“

Select Points of Interest, then select Business, then select Text fill and Text Outline and make their visibility as hidden. Select 兴趣点,然后是 select 业务,然后是 select 文本填充和文本轮廓,并使其可见性隐藏。

We'll click "Finish" button, then "copy JSON" button.我们将单击“完成”按钮,然后单击“复制 JSON”按钮。 Now we have JSON formatted data copied.现在我们复制了 JSON 格式化数据。

You may hold this info in a variable named, say mapStyle您可以将此信息保存在名为mapStyle的变量中

mapStyle=
[
  {
    "featureType": "poi.business",
    "elementType": "labels.text.fill",
    "stylers": [
      {
        "visibility": "off"
      }
    ]
  },
  {
    "featureType": "poi.business",
    "elementType": "labels.text.stroke",
    "stylers": [
      {
        "visibility": "off"
      }
    ]
  }
]

The last thing to do is to use mapStyle and making it equal to customMapStyle property like this..最后要做的是使用mapStyle并使其等于这样的customMapStyle属性..

<MapView 
  customMapStyle={mapStyle}

  {/*other properties*/}   
 />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM