React Native Maps:移动myLocationButton

问题描述

是否可以移动MyLocationButton的位置? 我正在使用Mapview并在其上面添加一些其他视图。这些视图之一位于MyLocationButton的顶部,从美学上讲,我想保持它->的位置,所以我应该改为移动MyLocationButton。有办法吗? x

<MapView
        style={styles.map}
        showsMyLocationButton = {true}
        showsUserLocation = {true}
        provider={PROVIDER_GOOGLE}
        customMapStyle={mapStyle}
        initialRegion={{
          latitude: this.state.mylocation.coords.latitude,longitude: this.state.mylocation.coords.longitude,latitudeDelta: 0.0922,//Zoom
          longitudeDelta: 0.0421,//Zoom
        }}>

解决方法

万一它对别人有帮助,我找到了一种解决方案,可以在地图继续覆盖所有屏幕的同时移动按钮的位置:

<MapView
(...)
        mapPadding={{top:0,right:0,left:0,bottom:230}}>
(...)
</Mapview>