Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native Maps : moving myLocationButton

Is there a way to move the position of MyLocationButton? I am using Mapview with some additional views on top of it. one of those views is on top of the MyLocationButton, and aesthetically I would like to keep it like that --> so I should move the MyLocationButton instead. Is there a way to do it? 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
        }}>
like image 262
Mireia Avatar asked Dec 06 '25 08:12

Mireia


1 Answers

In case it helps somebody, I found the solution to move the position of the button while the map continues to cover all the screen:

<MapView
(...)
        mapPadding={{top:0, right:0, left:0, bottom:230}}>
(...)
</Mapview>
like image 135
Mireia Avatar answered Dec 08 '25 05:12

Mireia



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!