【发布时间】:2020-11-26 04:39:48
【问题描述】:
我正在做一个项目,我需要一次在地图上显示至少 10 到 20 个标记。项目已退出世博会,并且由于支付了 Google Map,我正在使用 MapBox。
要在 react native 中添加地图,我正在使用 @react-native-mapbox-gl/maps": "^8.1.0-rc.9,但是文档不是那么好,所以我尝试了从一个媒体博客添加标记。但它有一些故障,如标记正在显示,但如果我缩小,标记也会移动。假设现在标记在孟买(印度),但如果我缩小它,它将在非洲。
这是我尝试过的
<MapboxGL.MapView
style={styles.map}
logoEnabled={false}
localizeLabels={true}
>
<MapboxGL.Camera
zoomLevel={18}
animationMode={'flyTo'}
animationDuration={1100}
centerCoordinate={[73.20812, 22.29941]}
/>
<View>
<MapboxGL.MarkerView id={'hello'} coordinate={[73.20812, 22.29941]}>
<View>
<Entypo
name='location-pin'
size={24}
color='black'
/>
</View>
</MapboxGL.MarkerView>
<MapboxGL.MarkerView
id={'hello'}
coordinate={[73.20813, 22.29941]}
>
<View>
<Entypo name='location-pin' size={24} color='black' />
</View>
</MapboxGL.MarkerView>
<MapboxGL.MarkerView id={'hello'} coordinate={[73.20814, 22.29941]}>
<View>
<Entypo name='location-pin' size={24} color='black' />
</View>
</MapboxGL.MarkerView>
<MapboxGL.MarkerView id={'hello'} coordinate={[73.20815, 22.29941]}>
<View>
<Entypo name='location-pin' size={24} color='black' />
</View>
</MapboxGL.MarkerView>
<MapboxGL.MarkerView id={'hello'} coordinate={[73.20816, 22.29941]}>
<View>
<Entypo name='location-pin' size={24} color='black' />
</View>
</MapboxGL.MarkerView>
</View>
</MapboxGL.MapView>
【问题讨论】:
标签: android react-native mapbox mapbox-gl-js mapbox-android