Skip to main content

Types

Main export​

import type {
ClusteredMapViewProps,
RenderClusterProps,
} from 'react-native-better-clustering'

ClusteredMapViewProps extends react-native-maps MapViewProps with clustering options (radius, minPoints, onClusterPress, renderCluster, etc.).

RenderClusterProps is passed to renderCluster — a ClusterFeature plus onPress, clusterColor, clusterTextColor, and tracksViewChanges.

GeoJSON types (/geojson)​

import type {
PointFeature,
ClusterFeature,
PointOrClusterFeature,
BBox,
} from 'react-native-better-clustering/geojson'

Cluster properties include cluster, cluster_id, point_count, point_count_abbreviated, and getExpansionRegion().

Engine types (/engine)​

import type {
SuperclusterOptions,
ClusterPropertyConfig,
MapDimensions,
} from 'react-native-better-clustering/engine'

SuperclusterOptions​

OptionDefaultDescription
radius40Cluster radius in pixels
minZoom1Min zoom for clustering
maxZoom20Max zoom for clustering
minPoints2Min points to form a cluster
extent512Tile extent
nodeSize64KD-tree leaf size
clusterProperties[]Map/reduce aggregation configs

Headless engine (ClusterEngine)​

Low-level Nitro hybrid object — create via createClusterEngine() from /engine. See the headless engine guide for lifecycle, isBuilt checks, and error behavior.

import {
createClusterEngine,
type ClusterEngine,
type ClusterEngineOptions,
type EngineClusterNode,
type Viewport,
} from 'react-native-better-clustering/engine'

Each EngineClusterNode has minLeafId: the smallest point id among its leaves (its own id for a point). A cluster keeps it across zoom levels while it only gains or loses other leaves, so it can key the cluster's marker.

Lifecycle: setOptions → setPoints (packPoints() buffer) → build() → query. Query methods throw when isBuilt is false; setPoints throws on invalid buffers.