问题描述
我的用户图标当前显示在地图标记的后面,如图所示。当我在android中使用showsUserLocation = {true}时,它似乎工作正常。有没有办法将用户位置图标推到地图标记的前面?也经历了这里的选项,但仍然没有运气github.com/react-native-maps/react-native-maps/issues/1668
我尝试使用zIndex = {-1},但这并没有将地图标记推到用户位置后面。
<Map
ref={refMap}
onPress={ondeselectVenue}
provider={PROVIDER_GOOGLE}
customMapStyle={MAP_STYLE}
showsMyLocationButton={false}
showsUserLocation={true}
initialRegion={{
latitude: coordinates.latitude,longitude: coordinates.longitude,latitudeDelta: 0.05,longitudeDelta: 0.05,}}>
{
state.clubLocations.map((clubLocation) => <ClubMarker key={clubLocation.clubId} zIndex={-1} inactive={isInactive(clubLocation)} onPress={onSelectLocation(clubLocation)} coordinate={clubLocation.location} />)
}
</Map>
ClubMarker组件
const ClubMarker = styled(Marker) <{ inactive: boolean }>`
width: 40px;
height: 40px;
opacity:${props => props.inactive ? 0.25 : 1.0};
`
type ClubMarkerProps = MarkerProps & {
coordinate : Coordinate,inactive: boolean
}
const ClubMarker = (props : ClubMarkerProps) =>
<ClubMarker onPress={props.onPress} coordinate={props.coordinate} inactive={ props.inactive }>
<Icons.PinClub width=40 height=40 />
</ClubMarker>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)