我正在使用React native开发一个示例应用程序.实际上,当我在图像上单击特定位置时,获取对应的x和y坐标.但是在该位置我想要多次显示标记和多个位置
这是我的显示代码:
return (
<View style={styles.container}>
<TouchableOpacity onPress={(evt) => this.handlePress(evt)}>
<Image source={require('./back1.jpg')} style={{resizeMode:'cover'}}>
</Image>
</TouchableOpacity>
</View>
);
Run Code Online (Sandbox Code Playgroud)
我的OnPress功能是:
handlePress(evt){
Alert.alert(`x coord = ${evt.nativeEvent.locationX}`);
Alert.alert(`y coord = ${evt.nativeEvent.locationY}`);
}
Run Code Online (Sandbox Code Playgroud)
这是我的ScreenShot只显示坐标:
我想要这种类型同时显示图像或图标的位置
任何人都可以帮我解决这个问题.
react-native ×1