我找到的当前解决方案如下(我知道它非常不优雅,而且我知道它可能真的不安全,因为碰撞盒可能仍然存在[碰撞盒仍然存在吗?]),但只需渲染标记并通过将半径设置为零让我能够实现这一目标。
所以我有以下标记渲染:
return (
<View key={marker.bike_no}>
{ <MapView.Marker
navigator={this.props.navigator}
coordinate={{longitude: marker.longitude, latitude: marker.latitude}}
title={marker.title}
description={marker.description}
onPress={(coord, pos) => this.startBookingBike(marker.bike_no)}
key={marker.key}
><View style={(marker.cur_user == 0) ? styles.bikeRadius : styles.markerStyleHidden }><View style={styles.bikeMarker}>
</View></View>
</MapView.Marker>
}</View>
);
使用此处定义的 style 属性:
markerStyleHidden: {
height: 0,
width: 0,
borderRadius: 0,
overflow: 'hidden',
backgroundColor: 'rgba(0, 122, 255, 0.5)',
borderWidth: 0,
borderColor: 'rgba(0, 122, 255, 0.5)',
alignItems: 'center',
justifyContent: 'center'
},
radius: {
height: 30,
width: 30,
borderRadius: 30 / 2,
overflow: 'hidden',
backgroundColor: 'rgba(0, 122, 255, 0.5)',
borderWidth: 4,
borderColor: 'rgba(0, 122, 255, 0.5)',
alignItems: 'center',
justifyContent: 'center'
},