react-native - showMyLocationButton 未在 Android 8 上显示
问题描述
我react-native-maps
在 android 6 及更低版本上使用它是 Okey。
但在更高版本的 Android 中,它不显示MyLocationButton
.
<MapView
zoomControlEnabled
showsMyLocationButton={true}
showsUserLocation={true}
>
{this.state.markers}
</MapView>
解决方案
以下代码适用于我并显示 MyLocationButton。
<MapView
customMapStyle={MapStyle}
style={styles.map}
provider="google"
showsUserLocation
renderMarker={this.renderMarker}
/>
如果最后你做不到,你可以创建一个示例按钮并在其 onPress 上,mapAnimateToRegion
转到用户位置。