Hye,我是 react native 的新手,想问一下如何在地图中渲染多个标记。
这是我的代码
课内:-
constructor(props) {
super(props);
this.state = {
coordinate: ([{
latitude: 3.148561,
longitude: 101.652778,
title: 'hello'
},
{
latitude: 3.149771,
longitude: 101.655449,
title: 'hello'
}
]),
};
}
内部渲染:-
<MapView
style={styles.map}
showsUserLocation={true}
followUserLocation={true}
zoomEnabled={true}
//annotations={markers}
>
<MapView.Marker
coordinate={this.state.coordinate}
title={this.state.coordinate.title}
/>
</MapView>
我想在地图中渲染这两个标记,但我不知道如何在本机反应中制作循环来渲染它。我已经尝试过文档中的内容,但仍然无法正常工作。
先感谢您 :)