react-native – 从google地图中删除标记
发布时间:2020-12-15 09:30:56 所属栏目:百科 来源:网络整理
导读:可以从地图视图中删除标记吗?如何从谷歌地图视图中删除标记.我使用“react-native-maps”显示谷歌地图. 请帮忙. 解决方法 为了能够删除或添加标记,您只需要执行此操作 //Note : my map markers is = this.props.markerscomponentDidMount() { this.renderMa
可以从地图视图中删除标记吗?如何从谷歌地图视图中删除标记.我使用“react-native-maps”显示谷歌地图.
请帮忙. 解决方法
为了能够删除或添加标记,您只需要执行此操作
//Note : my map markers is => this.props.markers componentDidMount() { this.renderMarkers(this.props.markers) } async renderMarkers(mapMarkers) { let markers = []; markers = mapMarkers.map(marker => (<Marker key={marker.code} coordinate={{latitude: marker.lat,longitude: marker.lng}} onPress={{}} />) ); this.setState({markers}); } refreshMarkers() { this.renderMarkers(this.props.markers).then(() => { this.forceUpdate(); }); } render() { return ( <MapView ref={(ref) => this.mapView = ref} style={styles.map} region={this.props.coordinate} > {this.state.markers} </MapView> ); } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- swift 源码网站 code4app
- AJAX - 创建 XMLHttpRequest 对象
- ruby-on-rails-3 – Rails 3 Cocoon link_to_add_associati
- c – 在Qt中右键单击事件以打开上下文菜单
- JSONP跨域的原理解析
- 嵌入式系统文件系统比较 jffs2, yaffs, cramfs, romfs, ram
- c# – 将LINQ序列中的项发送到返回void的方法
- 正则表达式 – Unicode和:alpha:
- break和continue,C语言break和continue的用法和区别
- u-boot-2014.10移植第22天----添加nand flash命令支持(四)