Search code examples
javascriptreact-nativegeolocationzoomingreact-native-maps

react-native-maps : How to get dynamic latitudeDelta and longitudeDelta values upon zoom-in and zoom-out


I have a specific requirement to display a polygon and a marker in map. When zoom-in, I display a polygon and multiple marker pin. But zoom-out i should use same polygon but display only 1 marker on it.

Current behavior : even while zoom-out when polygon becomes tiny it displays multiple markers on it.

enter image description here

Expected Behaviour : When it is zoom out only one marker should be visible. When it is zoomed in then all marker should be visible like below: Can someone help me fix this issue?

enter image description here

enter image description here


Solution

  • I fixed this issue by using onRegionChangeComplete function of element.

    Following is the code:

    onRegionChangeComplete = (e) => {
        this.setState({
          region: e,
        });
      };