How to zoom in/out in react-native-map?

后端 未结 2 1311
花落未央
花落未央 2020-12-08 10:24

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

2条回答
  •  无人及你
    2020-12-08 11:11

    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Δ).

提交回复
热议问题