加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

反应本机 – 反映本机地图聚类

发布时间:2020-12-15 20:52:28 所属栏目:百科 来源:网络整理
导读:我是新来的反应原生的,我想在我的应用程序中集成地图,我正在使用“react-native-maps”库 https://github.com/airbnb/react-native-maps 我想使用聚类,但是我无法找到与之相关的正确文档. 请帮助我找到如何将地图与群集集成在一起的文档,并且告诉哪个库最适
我是新来的反应原生的,我想在我的应用程序中集成地图,我正在使用“react-native-maps”库
https://github.com/airbnb/react-native-maps
我想使用聚类,但是我无法找到与之相关的正确文档.
请帮助我找到如何将地图与群集集成在一起的文档,并且告诉哪个库最适合实现平台,iOS和Android的群集.
您可以使用mapbox / supercluster repo和 here’s a gist显示如何实现超级群集React Native.它最初是为浏览器/节点应用程序开发的,但是您仍然可以简单地安装npm并使用它(javascript到处都是javascript).将集群标记添加到MapView(最初共享的 here)中:
<MapView ref={ref => { this.map = ref; }}>
  { this.state.markers.map((marker,index) => {
    return (
      <MapView.Marker 
        coordinate={{ latitude: marker.geometry.coordinates[1],longitude: marker.geometry.coordinates[0] }}
        onPress={() => this.markerPressed(marker)}>
        <Marker model={place} active={this.isSelected(place)} />
      </MapView.Marker>
    );
  })}
</MapView>

issue的反馈原始地图的警告:

The major issue is performance,if you need to display hundreds or
thousands of markers you’re gonna have to optimize the hell out of it,
and this is where it gets really hard.

反应原生地图也有一个主动冲突的PR,它解决了Android和iOS本身的这个问题,但它等待合并.但是,您可以手动实现它.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读