react-native-map-clustering icon indicating copy to clipboard operation
react-native-map-clustering copied to clipboard

Can not change region through the props 'region'?

Open thanhluantl2304 opened this issue 5 years ago • 3 comments

I used the props 'region' to change the map region dynamically. But when i use react-native-map-clustering, when i changed it from redux, it immediately reset the region to the initial region. So has any one faced this before? And what was the solution? THank all

thanhluantl2304 avatar May 20 '20 09:05 thanhluantl2304

Did you solve the issue?

maguayo avatar Oct 14 '20 17:10 maguayo

What did you do?

wdospinal avatar Dec 03 '20 15:12 wdospinal

I've solved the issue setting a useRef hook on MapView and then calling to onRegionChangeComplete() method:

const mapRef = useRef();

<MapView ref={mapRef} ... />

mapRef.current.onRegionChangeComplete({ latitude: -34.6077514, longitude: -58.3852248, latitudeDelta: 0.1, longitudeDelta: 0.1 })

dondopong avatar Feb 22 '22 04:02 dondopong