diff --git a/lib/ClusteredMapView.js b/lib/ClusteredMapView.js index 9e44320..0d02a3d 100644 --- a/lib/ClusteredMapView.js +++ b/lib/ClusteredMapView.js @@ -143,10 +143,10 @@ const ClusteredMapView = forwardRef( } updateMarkers(markers); onMarkersChange(markers); - onRegionChangeComplete(region, markers); + onRegionChangeComplete && onRegionChangeComplete(region, markers); updateRegion(region); } else { - onRegionChangeComplete(region); + onRegionChangeComplete && onRegionChangeComplete(region); } }; @@ -177,7 +177,7 @@ const ClusteredMapView = forwardRef( ref={(map) => { mapRef.current = map; if (ref) ref.current = map; - restProps.mapRef(map); + restProps.mapRef && restProps.mapRef(map); }} onRegionChangeComplete={_onRegionChangeComplete} >