Facebook的MapView仅用于显示注释(地图标记)吗?似乎没有办法为标记触摸事件添加事件处理程序。我必须使用类似http://react-components.com/component/react-native-mapbox-gl设置React-Native MapView触摸事件处理程序
1
A
回答
0
0
听到的是我的代码工作正常
constructor(props) {
super(props);
this.state = {
region : {latitude: LATITUDE,
longitude: LONGITUDE,
latitudeDelta: LATITUDE_DELTA,
longitudeDelta: LONGITUDE_DELTA,},
annotations : [],
};
for (var i = 0; i < this.props.list.length; i++) {
this.state.annotations[i] = {latitude:parseFloat(this.props.list[i].latitude),
longitude: parseFloat(this.props.list[i].longitude),
animateDrop: true,
/*title: this.props.list[i].name,
subtitle: this.props.list[i].address,*/
image : require('../images/icons/pharmacy-map-normal.png'),
id : i.toString()}
};
}
render() {
return (
<View>
<MapView
style={styles.map}
showsUserLocation={true}
region={this.state.region}
onAnnotationPress={this.onAnnotationPress}
annotations={this.state.annotations}>
</MapView>
</View>
);
}
onAnnotationPress =(annotation) =>{
alert(annotation.id)
}
相关问题
- 1. 重置触摸事件的事件处理程序
- 2. Phonegap触摸事件处理
- 3. 在Android中的MapView触摸事件
- 4. iPhone:在ImageView的处理触摸事件:
- 5. AppWidgetProvider处理触摸事件问题
- 6. Java中是否有触摸板事件处理程序?
- 7. LibGdx,如何处理触摸事件?
- 8. 从DDMS处理Android触摸事件
- 9. 使用MaskToBounds触摸事件处理NO
- 10. 设置事件处理程序?
- 11. Cocos2d-x和处理触摸事件
- 12. 在Apple上处理触摸事件 - Highcharts
- 13. Seekbar无法处理触摸事件
- 14. 的UIButton设置触摸处理程序代码
- 15. WPF触摸/摇摄滚动事件处理程序
- 16. 处理触摸开始和触摸结束事件
- 17. 处理触摸事件到一个UITableCell
- 18. 如何处理IE10触摸事件?
- 19. 处理时禁用触摸事件
- 20. 在uiscrollview中处理触摸事件
- 21. 地图视图触摸事件处理
- 22. 触及UIImageView的事件处理程序
- 23. Sharepoint事件处理程序未触发
- 24. 处理UITextView触摸事件时,触摸它的一个单词
- 25. Sencha触摸标签处理程序
- 26. iOS通用触摸处理程序
- 27. 事件处理程序触发System.StackOverflowException
- 28. Javascript事件处理程序未触发
- 29. 在iOS设备上处理触摸事件
- 30. cocos2d-js android设备不响应触摸事件,iOS和web确实可以处理触摸事件
我试过在MapView类的onAnnotationPress但它不会做任何事情。 ' ' 和处理它的函数 'onAnnotationPress(id){ \t console.log('onAnnotationPress yooooo'+ id); },' –
Bundeeteddee