反应本机 MabBox MarkerView 问题
React Native MabBox MarkerView issue
我正在做一个项目,我需要一次在地图上显示至少 10 到 20 个标记。项目从 expo 中退出,由于 Google 地图已支付,我正在使用 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>
我刚刚进行了一项更改,现在可以正常工作了。
我已将 MapboxGL.MarkerView 更改为 MapboxGL.PointAnnotation,现在缩小标记保持不变。
我正在做一个项目,我需要一次在地图上显示至少 10 到 20 个标记。项目从 expo 中退出,由于 Google 地图已支付,我正在使用 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>
我刚刚进行了一项更改,现在可以正常工作了。
我已将 MapboxGL.MarkerView 更改为 MapboxGL.PointAnnotation,现在缩小标记保持不变。