npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

rs-react-native-map-clustering

v6.0.1

Published

React Native Map Clustering both for Android and iOS with TypeScript support

Downloads

247

Readme

React Native Map Clustering

npm version license downloads

A powerful React Native module that elegantly handles map clustering with full TypeScript support.

Works seamlessly with Expo and react-native-cli 🚀

This is a maintained fork of react-native-map-clustering with SuperCluster v8.0.1 and complete TypeScript typings.

📋 Table of Contents

✨ Features

  • Fully typed with comprehensive TypeScript declarations
  • High performance clustering using SuperCluster v8.0.1
  • Customizable markers, clusters, and animations
  • Spider mode for elegant handling of overlapping markers
  • Optimized rendering with minimal re-renders for smooth performance
  • Compatible with both Expo and React Native CLI
  • Cross-platform with full iOS and Android support

📦 Installation

# Using npm
npm install rs-react-native-map-clustering react-native-maps --save

# Using yarn
yarn add rs-react-native-map-clustering react-native-maps

# Using pnpm
pnpm add rs-react-native-map-clustering react-native-maps

# Using bun
bun add rs-react-native-map-clustering react-native-maps

🚀 Quick Start

import React from 'react';
import { StyleSheet, View } from 'react-native';
import MapView from 'rs-react-native-map-clustering';
import { Marker } from 'react-native-maps';

export default function App() {
  return (
    <View style={styles.container}>
      <MapView
        style={styles.map}
        initialRegion={{
          latitude: 52.5,
          longitude: 19.2,
          latitudeDelta: 8.5,
          longitudeDelta: 8.5,
        }}
      >
        <Marker coordinate={{ latitude: 52.4, longitude: 18.7 }} />
        <Marker coordinate={{ latitude: 52.1, longitude: 18.4 }} />
        <Marker coordinate={{ latitude: 52.6, longitude: 18.3 }} />
        <Marker coordinate={{ latitude: 51.6, longitude: 18.0 }} />
        <Marker coordinate={{ latitude: 53.1, longitude: 18.8 }} />
      </MapView>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
  },
  map: {
    flex: 1,
  },
});

🔍 TypeScript Support

The library comes with full TypeScript support and exports helpful types for your development.

import React, { useRef } from 'react';
import { View, StyleSheet } from 'react-native';
import MapView, { ClusteredMapProps } from 'rs-react-native-map-clustering';
import { Marker } from 'react-native-maps';

const INITIAL_REGION = {
  latitude: 52.5,
  longitude: 19.2,
  latitudeDelta: 8.5,
  longitudeDelta: 8.5,
};

const App = () => {
  const mapRef = useRef<MapView>(null);
  
  // Access to exported types
  const clusteringOptions: Partial<ClusteredMapProps> = {
    clusterColor: '#FF0000',
    spiralEnabled: true,
    tracksViewChanges: false
  };

  return (
    <View style={styles.container}>
      <MapView
        ref={mapRef}
        initialRegion={INITIAL_REGION}
        style={styles.map}
        {...clusteringOptions}
      >
        <Marker coordinate={{ latitude: 52.4, longitude: 18.7 }} />
        <Marker coordinate={{ latitude: 52.1, longitude: 18.4 }} />
        <Marker coordinate={{ latitude: 52.6, longitude: 18.3 }} />
        <Marker coordinate={{ latitude: 51.6, longitude: 18.0 }} />
        <Marker coordinate={{ latitude: 53.1, longitude: 18.8 }} />
      </MapView>
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
  },
  map: {
    flex: 1,
  },
});

export default App;

⚙️ Props

| Name | Type | Default | Description | | ------------------------------------------- | --------------------- | -------------------------------------------- | ------------------------------------------------------------------------ | | clusterColor | String | #00B386 | Background color of clusters | | clusterTextColor | String | #FFFFFF | Color of text in clusters | | clusterFontFamily | String | undefined | Font family of text in clusters | | onClusterPress(cluster, markers) | Function | () => {} | Handles cluster click events with cluster data and its markers | | tracksViewChanges | Boolean | false | Controls whether cluster markers track view changes | | radius | Number | window.width * 6% | SuperCluster radius | | extent | Number | 512 | SuperCluster extent | | minZoom | Number | 1 | SuperCluster minZoom | | maxZoom | Number | 20 | SuperCluster maxZoom | | minPoints | Number | 2 | SuperCluster minPoints | | preserveClusterPressBehavior | Boolean | false | If true, disables auto-zooming when clicking on a cluster | | edgePadding | Object | { top: 50, left: 50, bottom: 50, right: 50 } | Padding for fitToCoordinates when focusing on clusters | | animationEnabled | Boolean | true | Enables animations for clusters (iOS only) | | layoutAnimationConf | LayoutAnimationConfig | LayoutAnimation.Presets.spring | Animation configuration for clusters (iOS only) | | onRegionChangeComplete(region, markers) | Function | () => {} | Called when map region finishes changing | | onMarkersChange(markers) | Function | () => {} | Called when markers data changes | | superClusterRef | MutableRefObject | {} | Provides direct access to the SuperCluster instance | | clusteringEnabled | Boolean | true | Enables/disables clustering functionality | | spiralEnabled | Boolean | true | Controls spiral view for overlapping markers | | renderCluster | Function | undefined | Custom rendering function for clusters | | spiderLineColor | String | #FF0000 | Color of lines connecting markers in spider mode |

📱 Examples

Animate Map to Region

import React, { useRef } from "react";
import { Button, View, StyleSheet } from "react-native";
import MapView from "rs-react-native-map-clustering";
import { Marker } from "react-native-maps";

const App = () => {
  const mapRef = useRef(null);

  const animateToRegion = () => {
    mapRef.current?.animateToRegion({
      latitude: 42.5,
      longitude: 15.2,
      latitudeDelta: 7.5,
      longitudeDelta: 7.5,
    }, 2000);
  };

  return (
    <View style={styles.container}>
      <MapView
        ref={mapRef}
        style={styles.map}
        initialRegion={{
          latitude: 52.5,
          longitude: 19.2,
          latitudeDelta: 8.5,
          longitudeDelta: 8.5,
        }}
      />
      <Button onPress={animateToRegion} title="Animate to Italy" />
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
  },
  map: {
    flex: 1,
  },
});

export default App;

Custom Cluster Rendering

import React from "react";
import { View, Text, StyleSheet } from "react-native";
import MapView from "rs-react-native-map-clustering";
import { Marker } from "react-native-maps";

const CustomClusterMarker = ({ onPress, geometry, properties }) => {
  const { point_count } = properties;
  return (
    <Marker
      coordinate={{
        latitude: geometry.coordinates[1],
        longitude: geometry.coordinates[0],
      }}
      onPress={onPress}
    >
      <View style={styles.customCluster}>
        <Text style={styles.customClusterText}>{point_count}</Text>
      </View>
    </Marker>
  );
};

const App = () => {
  return (
    <View style={styles.container}>
      <MapView
        style={styles.map}
        initialRegion={{
          latitude: 52.5,
          longitude: 19.2,
          latitudeDelta: 8.5,
          longitudeDelta: 8.5,
        }}
        renderCluster={CustomClusterMarker}
      >
        {/* Add your markers here */}
      </MapView>
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
  },
  map: {
    flex: 1,
  },
  customCluster: {
    backgroundColor: "purple",
    borderRadius: 25,
    padding: 10,
    width: 50,
    height: 50,
    justifyContent: "center",
    alignItems: "center",
  },
  customClusterText: {
    color: "#FFFFFF",
    fontWeight: "bold",
  },
});

export default App;

🤝 Support

Feel free to create issues and pull requests on the GitHub repository. We welcome contributions and feedback to make this library even better.

Happy Coding! 💖🚀