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.
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?
I fixed this issue by using onRegionChangeComplete
function of element.
Following is the code:
onRegionChangeComplete = (e) => {
this.setState({
region: e,
});
};