javascript - 响应谷歌地图 onMarkerClick 事件未在移动设备中触发
问题描述
initialCenter={{
lat: lat,
lng: lng
}}
onClick={this.onMapClicked}
zoom={zoom}>
{this.state.marker.map((data, index) => {
return (
<Marker
ref={this.onMarkerMounted}
key={index}
onClick={this.onMarkerClick}
name={data.name}
phone={data.phone}
icon={{
url: data.icon,
anchor: new this.props.google.maps.Point(20, 20),
scaledSize: new this.props.google.maps.Size(80, 80)
}}
position={{"lat": data.lat, "lng": data.lng}}/>
)
}
)}
<InfoWindow
marker={this.state.activeMarker}
visible={this.state.showingInfoWindow}
onClose={this.onClose}
>
<View style={{width: 100, height: 20}}>
<Text style={{
fontWeight: '600',
fontSize: 14,
color: "#54AD58"
}}>{this.state.selectedPlace.phone}</Text>
</View>
</InfoWindow>
</Map>
在 React google maps 中,Marker Touch 事件在移动视图中不起作用。相同的功能在桌面视图上运行良好。但是当我为 mobileview 调用这个函数时,它不能正常工作。
如果我更改了名为 this.onMarkerClick() 的函数,这应该在我触摸地图时调用该函数,但这将无法正常工作。onMapclicked 事件在移动视图和桌面视图中工作。我不知道是什么问题。。
解决方案
推荐阅读
- android - java.lang.IllegalStateException:无法在 HMS 扫描套件中执行 android:onClick 的方法
- c# - .Net Core Identtiy 电子邮件确认令牌一旦使用就应该是无效的
- java - 如何在 OpenLDAP(UnboundID Java API)中获取组(嵌套)用户
- abap - SCI 检查期间的 SWLT 短转储
- jenkins - 具有条件的 Jenkins 流水线阶段
- c++ - 使用 libipt,如何为 TCP 数据包添加匹配规则,例如“dport”?
- python - 有没有办法使用 Python 实时检测扬声器的声音活动?
- html - 更改按钮的背景颜色以在选择时流入标题
- python - 如何定义与特定 RegExp 匹配的所有二进制字符串的列表?
- scala - 并行处理多个数据帧 Scala