![](/img/trans.png)
[英]I am unable to install react navigation using expo (react-native-gesture-handler isn't installed)
[英]I am trying to use onLongPress in react native with expo but it isn't working
任何人都可以阐明为什么onlongPress无法正常工作的原因。 我在EXPO中使用react native。 MapView是从expo导入的
<MapView.Marker
style={styles.map}
key={marker.pageid}
coordinate={coords}
description={`distance: ${marker.distance}m`}
longPressDelay={1000}
onLongPress={() => {
console.log('hit');
}}
onPress={() =>
this.map.fitToCoordinates(
[
{
latitude: this.props.latitude,
longitude: this.props.longitude
},
coords
],
{
edgePadding: {
top: 150,
right: 5,
bottom: 5,
left: 10
},
animated: true
}
)
}
>
这是因为Marker没有onLongPress事件:)
您不会在MapView.Marker
上找到该onLongPress
事件。 您可以使用其他View进行包装,在这种情况下,您会遇到样式方面的问题,因此请相应地更新样式。
或遵循这种方法
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.