I am using react-native to build a map application. The api I am using is from this link: https://github.com/lelandrichardson/react-native-maps. Below is the code I bring th
I was able to make this work using Dimensions.get('window');
const window = Dimensions.get('window');
const { width, height } = window
LONGITUDE_DELTA = LATITUD_DELTA + (width / height)
and by default set LATITUD_DELTA = 0.0922
.
Then just update this values with the prop onRegionChangeComplete
in the <MapView>
You should use the animateToRegion
method (see here)
It takes a region object which has latitudeDelta
and longitudeDelta
. Use these to set the zoom level.
Updated:
in a Region
object the latitude
and longitude
specify the center location and latitudeDelta
and longitudeDelta
specify the span of the viewable map area.
This image from this blog post illustrates it well (LatΔ and LngΔ).