问题描述
我正在谷歌地图中映射标记。
例如,我按下了任何标记模式将仅显示第三个数组标记数据。
如何显示任何其他数组标记数据?
我认为它会使用 componentDidUpdate
,但我不会写代码,请帮忙。
我使用 react-native-maps
和 react-native-modalize
标记数据
export const locations = {
markers: [
{
index: '1',coordinate: {
latitude: 37.449642,longitude: 127.127142
},title: "bread",company: "paba",price: "3000",description: "pa",img: "https://t1.daumcdn.net/cfile/blog/251112342853B589A8D8F2B",},{
index: '2',coordinate: {
latitude: 37.451299,longitude: 127.129404
},title: "youget",company: "711",price: "1000",description: "711",img: "https://www.mpps.co.kr/kfcs_api_img/KFWECS/goods/DL_2174223_20200903093553622.PNG"
},{
index: '3',coordinate: {
latitude: 37.448789,longitude: 127.127100
},title: "coke",company: "famil",description: "famil",img: "https://image.auction.co.kr/itemimage/12/36/f2/1236f20cb63212.jpg"
},]
}
打开模态
mapMarkers = (_marker) => {
return locations.markers.map((_marker,i) => (
<View>
<Marker
key={_marker['index']}
coordinate={_marker['coordinate']}
//title={_marker.title}
//description={_marker['description']}
onPress={this.openModal}
>
</Marker>
</View>
))
}
modalScreen = () => {
return locations.markers.map((_marker) => (
<Modalize
ref={this.modal}
snapPoint={200}
modalTopOffset={100}
overlayStyle={{
backgroundColor: 'transparent'
}}
>
<View>
<View style={styles.bubble}>
<Text style={styles.name}> {_marker.title}</Text>
{<Text style={styles.company}> {_marker.company} </Text>}
<Text style={styles.price}>{_marker.price}</Text>
<Image style={styles.image}
source={{ uri: _marker['img'] }}
/>
</View>
</View>
</Modalize>
))
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)