Thank you for your interest in contributing to react-native-better-clustering! This document provides guidelines and instructions for contributing to the project.
- Code of Conduct
- Getting Started
- Development Setup
- Project Structure
- Development Workflow
- Code Style
- Testing
- Nitro Modules
- Pull Request Process
This project adheres to a Code of Conduct. By participating, you are expected to uphold this code.
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/YOUR_USERNAME/react-native-better-clustering.git cd react-native-better-clustering - Add the upstream remote:
git remote add upstream https://github.com/gmi-software/react-native-better-clustering.git
- Node.js (v20 or higher)
- Bun
- React Native development environment
- For iOS: Xcode and CocoaPods
- For Android: Android Studio and Android SDK
- Expo CLI (for running the example app)
# Install all workspaces (package, example, docs)
bun install
# Generate Nitro bindings (required after cloning or changing specs)
cd package
bun run specsThe example app in /example is used for testing and verification:
cd example
# iOS
bunx expo prebuild
bunx expo run:ios
# Android
bunx expo prebuild
bunx expo run:androidreact-native-better-clustering/
├── package/ # Main library package (react-native-better-clustering)
│ ├── src/ # TypeScript source
│ │ ├── compat/ # Primary MapView entry (root export)
│ │ ├── clusterer/ # Legacy render helper (undocumented subpath)
│ │ ├── engine/ # Supercluster engine bindings
│ │ ├── hooks/ # React hooks (useClusterer) — advanced subpath
│ │ ├── specs/ # Nitro Module specifications (*.nitro.ts)
│ │ └── utils/ # Shared utilities
│ ├── cpp/ # Shared C++ clustering core (ClusterEngine)
│ ├── android/ # Android native module (C++ via CMake)
│ └── nitrogen/ # Nitrogen-generated bindings
├── example/ # Expo example app
└── docs/ # Docusaurus documentation site
- Generate Nitro bindings:
cd package && bun run specs - Typecheck:
cd package && bun run typecheck - Lint:
cd package && bun run lint - Test:
cd package && bun run test
- The project uses ESLint and Prettier. Run
cd package && bun run lintbefore committing. - Keep changes scoped and avoid drive-by refactors.
- Unit tests run with Jest:
cd package && bun run test. - The C++ clustering core has a standalone test:
cd package/cpp c++ -std=c++20 -I. ClusterEngineCore.test.cpp -o cluster_test ./cluster_test
- Specs and types are generated by Nitrogen from
*.nitro.tsfiles. - After changing any spec or Hybrid Object type, run
cd package && bun run specsand commit the regenerated files underpackage/nitrogen/.
- Create a feature branch from
main. - Make your changes with clear, focused commits.
- Ensure lint, typecheck, and tests pass.
- Update documentation under
docs/andREADME.mdfor any public API or setup changes. - Open a pull request with a clear summary, test plan, and risk notes (see AGENTS.md).
From package/ after manual testing on iOS and Android:
bun run build
bun run test:ci
bun run releaseThis runs release-it (see .release-it.json): builds, tests, creates a git tag,
GitHub release, and publishes to npm. Review CHANGELOG.md before releasing.
-
cd example && bunx expo prebuild --clean -
bunx expo run:ios— RNBC tab renders 30k clustered markers; tap cluster zooms; pan/zoom is smooth -
bunx expo run:android— same, with Google Maps key configured - Verify
cluster={false}marker stays unclustered;renderClustercustom bubble shows - Confirm no
react-native-better-clustering:errors in Metro logs -
cd package && bun run build && bun run verify:buildbeforebun run release