react-native-maps-clusterize
React Native MapView clustering component for iOS + Android
Made by CODEMPIRE
Examples
Zoom in | Zoom out |
---|---|
![]() |
![]() |
Cluster Expand | Nested Cluster Expand |
![]() |
![]() |
Installation
-
Install
react-native-maps
-
Install this component
npm install --save react-native-maps-clusterize
Usage
;; <ClusterMap region= latitude: 3778825 longitude: -1224324 latitudeDelta: 00922 longitudeDelta: 00421 > <Marker coordinate= latitude:3778725 longitude: -122434 /> <Marker coordinate= latitude:37789 longitude: -122431 /> <Marker coordinate= latitude:3778825 longitude:-1224324 /></ClusterMap>
Custom Cluster Marker
You can customize cluster marker with renderClusterMarker prop
MyMap.jsx
;; // ... <MyCluster count=count /> { const markers region = thisstate; return <ClusterMap renderClusterMarker=thisrenderCustomClusterMarker region=region > markers <ClusterMap> }
MyCluster.jsx
;; const MyCluster = { const count = props; return <View style=styles> <Text>count</Text> </View> } const styles = StyleSheet
Result
Props
Props | Type | Default | Note |
---|---|---|---|
superClusterOptions | Options | { radius: 16, maxZoom: 15, minZoom: 1, nodeSize: 16 } | SuperCluster lib options |
isClusterExpandClick | boolean | true | Enables cluster zoom on click |
region | Region | required | Google Map Region |
priorityMarker | ReactNode | null | Marker which will be outside of clusters |
renderClusterMarker | ():ReactNode | () => { return <CustomClusterMarker /> } | Returns cluster marker component |
style | StyleProp | absoluteFillObject | Styling for MapView |
Also contains react-native-maps <MapView /> Props
Events
Event Name | Returns | Notes |
---|---|---|
onClusterClick | void | Callback that is called when the user pressed on the cluster marker |
onZoomChange | void | Callback that is called with updated map zoom in number |
Also contains react-native-maps <MapView /> Events