Index of every page on this site: llms.txt
All skills
gmi-software avatar

/react-native-better-clustering

@443959a
Run it yourself

Expert guide to react-native-better-clustering — a drop-in clustered MapView for react-native-maps backed by a C++ supercluster engine over Nitro/JSI. Use when installing, configuring, or debugging it; when clustering is slow, wrong, or flickering; when handling thousands of map markers; when migrating from react-native-map-clustering or react-native-clusterer; and when changing the library's TypeScript, C++, or Nitro specs. Also use before writing any performance claim about map clustering, pan, zoom, or marker frame rate.

  • 11 files
  • 102.9 KB
  • MIT
  • Updated 3 months ago
  • GitHub
Use this Skill: https://skilld.dev/gh/gmi-software/better-skills/react-native-better-clustering

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencessetup.md

≈1.4k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Setup / installation

Source: package/package.json peers, library README.md, docs/docs/setup/installation.md, example package.json, podspec / Android gradle. Paths relative to the library checkout.

Native architecture detail: architecture.md. Platform crash deltas: debugging.md.

Requirements (verified)

Requirement Detail
React Native 0.78+ with New Architecture enabled (Nitro)
Package version react-native-better-clustering@1.0.0 (verify against your lockfile)
Expo Development build only — Expo Go cannot load this Nitro module
Map rendering react-native-maps required for the root MapView export; headless /engine can run without maps

Peer dependencies (package/package.json)

Peer Constraint Notes
react *
react-native * New Arch
react-native-nitro-modules * Required — HybridObject runtime
react-native-reanimated >=4.0.0 Cluster bubble fade (ClusterMarker)
react-native-worklets >=0.6.0 Required peer; not imported by library source — Reanimated 4 needs it
react-native-maps * peerDependenciesMeta.optional: true, but required for the main MapView export

Example app pins (not peer floors): react-native-maps@^1.26.0, react-native-reanimated@^4.5.0, react-native-worklets@^0.10.0.

Bare React Native

npm install react-native-better-clustering react-native-nitro-modules react-native-maps react-native-reanimated react-native-worklets
cd ios && pod install && cd ..

Rebuild the native app after install.

Add the Worklets Babel plugin last in babel.config.js (library README / installation docs):

module.exports = {
  presets: ['module:@react-native/babel-preset'],
  plugins: ['react-native-worklets/plugin'],
}

Confirm New Architecture is on (newArchEnabled=true / RN New Arch project setting), then rebuild.

Android Google Maps key

Blank Android map is almost always the Maps API key, not clustering. Add to AndroidManifest.xml:

<meta-data
  android:name="com.google.android.geo.API_KEY"
  android:value="YOUR_GOOGLE_MAPS_API_KEY"/>

Expo

npx expo install react-native-better-clustering react-native-nitro-modules react-native-maps react-native-reanimated react-native-worklets

babel-preset-expo adds the Worklets plugin — no Babel change needed for Expo.

Add the react-native-maps config plugin to app.json / app.config.*. At react-native-maps 1.29.0 the plugin accepts only these two keys — there is no googleMapsApiKey option:

{
  "expo": {
    "plugins": [
      [
        "react-native-maps",
        {
          "iosGoogleMapsApiKey": "YOUR_IOS_GOOGLE_MAPS_API_KEY",
          "androidGoogleMapsApiKey": "YOUR_ANDROID_GOOGLE_MAPS_API_KEY"
        }
      ]
    ]
  }
}

Then:

npx expo prebuild --clean
npx expo run:ios
# or
npx expo run:android

This package has no Expo config plugin of its own; maps key comes from the react-native-maps plugin (or bare manifest).

iOS install bits

Clustering is C++. Podspec NitroMapCluster compiles package/cpp/** and nitrogen-generated bridge files. No hand-written Swift clusterer.

After adding the JS package: cd ios && pod install and a native rebuild. Expo: expo prebuild then expo run:ios.

Unresolved NitroMapCluster / HybridObject registry → missing pod install or Old Architecture.

Podspec does not set explicit C++ optimization flags — Debug vs Release follows Xcode project settings (performance.md).

Android install bits

Clustering is C++ via CMake (libNitroMapCluster.so). Kotlin is a load stub plus generated OnLoad.

Gradle library (package/android/build.gradle):

  • minSdk 24, compile/targetSdk 36, NDK 27.1.12297006 (gradle.properties)
  • IS_NEW_ARCHITECTURE_ENABLED from root newArchEnabled
  • CMake -DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON (16 KB page devices)
  • Debug native: -O1 -g; release: -O2
  • fix-prefab.gradle forces prefab to include the .so

Packaging excludes libc++_shared.so and other RN/Nitro .sos so the app does not double-pack them.

Prefab without the .so → app cmake cannot link NitroMapCluster. Missing ABI → check reactNativeArchitectures vs the device.

Failure checklist

Symptom Check
Module / HybridObject missing New Arch off; Expo Go; forgot native rebuild / pod install
Blank Android map Google Maps API key / Maps SDK enabled
Reanimated / worklets runtime errors Worklets Babel plugin missing (bare); peers not installed
Link / cmake / prefab errors Android bits above + architecture.md
iOS unresolved NitroMapCluster pod install + rebuild

Verifying the install

# version actually installed
rg '"version"' node_modules/react-native-better-clustering/package.json

# native pieces present (required for the engine to build)
ls node_modules/react-native-better-clustering/cpp
ls node_modules/react-native-better-clustering/nitrogen

Then render a small MapView with Marker children. If clusters appear when zoomed out and split when zoomed in, the native engine is loaded.

What setup does not prove

A successful pod install / assembleDebug proves the module links. It does not prove map FPS or clustering performance — measure on a release (or release-like) device build (performance.md).

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at 443959a. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last month.

Steadyupdated 3 months ago
Other metadata
metadata
{
  "package": "react-native-better-clustering",
  "version": "1.0.0",
  "commit": "7c7d659046a3d1bb8b7d4cb06a94f6e0d509862e",
  "verified": "2026-08-21",
  "repository": "https://github.com/gmi-software/react-native-better-clustering",
  "audience": "library users and library contributors",
  "tags": "react-native, clustering, maps, markers, geospatial, supercluster, nitro, jsi, cpp, performance, ios, android, expo"
}

README badge

README badge for gmi-software/better-skills/react-native-better-clustering