【发布时间】:2020-07-24 13:20:21
【问题描述】:
使用下面的代码,如果我单击标记,它会导航到我提到的页面,但我希望在标记标题而不是标记上实现这一点,有什么方法可以使标题可点击。请帮忙。
return (
<MapView
style={styles.map}
placeholder="Search location"
minLength={2}
region={focusRegion}
// onPress={componentDidMount()}
onMapReady={getLocationHandler}
showsUserLocation={true}
//followsUserLocation={true}
loadingEnabled={true}
loadingIndicatorColor={"#606060"}
>
{places.map((marker) => (
<Marker
key={marker.id}
coordinate={{ latitude: marker.lat, longitude: marker.lng }}
title={(marker.title)}
onPress={() => {
props.navigation.navigate("PlaceDetail", {
placeTitle: marker.title,
placeId: marker.id,
});
}}
>
</MapView>
);
【问题讨论】:
标签: javascript reactjs react-native google-maps react-native-maps