This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is the React Native Mapbox Maps SDK (@rnmapbox/maps) - a community-supported library for building maps with Mapbox Maps SDK for iOS and Android in React Native applications.
- Node.js: This project requires Node.js v22.16.0 (see .nvmrc)
- The project has been updated to use Node.js 22 with the new import syntax
- Use
nvm useto switch to the correct version
# Install dependencies
yarn install
# Run the example app
cd example
yarn ios # iOS: runs on iPhone SE (3rd generation) simulator
yarn android # Android
# Web development (experimental)
yarn web # or: npx expo start -c --web
# Install iOS pods
yarn pod:install# Run tests
yarn test # Runs lint and unit tests
yarn unittest # Just unit tests
yarn unittest:single "test name" # Run specific test
# Code quality
yarn lint # ESLint check
yarn lint:fix # Auto-fix ESLint issues
yarn type:check # TypeScript type checking
# In example app
cd example && yarn type:check# IMPORTANT: Run after making changes to components or style properties
yarn generate
# This updates:
# - TypeScript definitions from style-spec
# - iOS/Android native style setters
# - Component documentation
# - Codepart replacementsThe project uses Mapbox Maps SDK v11 and React Native's New Architecture (Fabric/TurboModules) exclusively.
- Components (
src/components/): React Native components that wrap native Mapbox functionality- Layer components:
BackgroundLayer,CircleLayer,FillLayer,LineLayer, etc. - Source components:
VectorSource,ShapeSource,RasterSource, etc. - Core components:
MapView,Camera,UserLocation,MarkerView,PointAnnotation - Each component extends either
AbstractLayerorAbstractSourcefor common functionality
- Layer components:
- Specs (
src/specs/): TurboModule/Fabric component specs - Native Components: Each component has corresponding native implementations:
- iOS:
ios/RNMBX/RNMBX*.swiftandRNMBX*ComponentView.mm - Android:
android/src/main/java/(generated from specs)
- iOS:
- location: Location management and custom location providers
- offline: Offline map pack management and tile store
- snapshot: Map snapshot generation
- Styles are defined in
style-spec/v8.json(Mapbox style specification) - TypeScript definitions generated in
utils/MapboxStyles.ts - Native style setters generated for iOS/Android
- Update TypeScript component in
src/components/ - Update or create specs in
src/specs/if needed - Run
yarn generateto update generated code - Implement native changes if required
- Add example in
example/src/examples/ - Update tests in
__tests__/
- Layer styles use the Mapbox Style Specification
- Style props are validated and converted through
StyleValueutilities - Dynamic styles can use expressions and data-driven styling
- Unit tests use Jest with React Native preset
- Components are tested with mocked native modules
- Example app serves as integration testing ground
- Use
yarn testbefore committing
- Detox tests in
example/e2e/docScreenshots.e2e.jscapture screenshots of every example for documentation - Examples with JS timers or animations that block Detox sync should set
disableSync: truein their metadata - See CONTRIBUTING.md for build and run instructions
- Component docs are auto-generated from JSDoc comments
- Don't edit
.mdfiles indocs/directly - edit source files and runyarn generate - Examples in
example/src/examples/are used for documentation
- Always run
yarn generateafter modifying components or styles - The example app is the primary way to test changes
- Native changes require rebuilding the app
- Web support is experimental and may have limited functionality
- Requires React Native 0.79+ with New Architecture (Fabric/TurboModules)