Android 反应本机地图标注问题,地图弹出按钮单击不工作
我想在react native中单击地图弹出窗口中的Android 反应本机地图标注问题,地图弹出按钮单击不工作,android,google-maps,react-native,android-mapview,Android,Google Maps,React Native,Android Mapview,我想在react native中单击地图弹出窗口中的按钮,下面是我的代码 render() { console.log(TAG + "in render") return ( <View style={{ flex: 1 }}> { (this.state.coords != null) ? <MapView
按钮
,下面是我的代码
render() {
console.log(TAG + "in render")
return (
<View style={{ flex: 1 }}>
{
(this.state.coords != null) ?
<MapView
style={styles.map}
region={this.state.mapRegion}
showsUserLocation={true}
followUserLocation={true}
onRegionChange={this.onRegionChange.bind(this)}
onPress={this.onMapPress.bind(this)}>
< MapView.Polyline
coordinates = {
this.state.coords
}
strokeWidth = {
4
}
/>
<MapView.Marker
coordinate={
{
latitude: this.state.lastLat,
longitude: this.state.lastLong,
}
}
>
<MapView.Callout tooltip>
<View style={styles.bubble}>
<View >
<Button title='Click Me!' onPress={() => alert('Click')} />
</View>
</View>
</MapView.Callout>
</MapView.Marker>
< MapView.Marker
coordinate={
{
latitude: this.state.destination.latitude,
longitude: this.state.destination.longitude,
}
}
/>
</MapView> :null
}
</View>
);
}
当我在安卓系统中运行上述代码时,我没有点击按钮
,我把它放在MapView.Callout
中
onPress={() => alert('Click')}
我不能在点击按钮时得到提醒,你知道我怎样才能得到点击按钮吗?你的建议都很有价值。我也有同样的问题,你找到解决办法了吗?
onPress={() => alert('Click')}