About the Example App
The Mapbox Maps SDK for React Native includes a comprehensive demo application with over 100 working examples. These examples demonstrate all major features of the SDK, from basic map rendering to advanced data visualization and animations.Running the Examples
The example app is located in theexample/ directory of the SDK repository. To run it:
Installation
- Navigate to the example directory:
-
Create an
accesstokenfile in the root with your Mapbox access token - Install dependencies:
- For iOS, install pods:
Running on iOS
Running on Android
If you’re using
nvm, copy ios/.xcode.env as ios/.xcode.env.local and modify as needed.Example Categories
The examples are organized into the following categories:Map Basics
- ShowMap - Basic map with user location tracking
- StyleJSON - Custom map styles using JSON
- ChangeLayerColor - Dynamically modify layer styles
- MapAndRNNavigation - Integration with React Navigation
Camera Controls
- FlyTo - Animated camera transitions
- Fit - Fit camera to bounds
- SetPitch - Control camera pitch/tilt
- RestrictMapBounds - Limit pan area
Annotations & Markers
- ShowPointAnnotation - Interactive point annotations
- MarkerView - Custom marker views
- CustomCallout - Custom annotation callouts
Data Visualization
- Heatmap - Heatmap layer for density visualization
- Earthquakes - Clustering with custom properties
- DataDrivenCircleColors - Data-driven styling
- ChoroplethLayerByZoomLevel - Choropleth maps
Animations
- AnimatedPoint - Animate marker positions
- DriveTheLine - Route animation
- AnimatedLine - Line animations
Advanced Features
- OfflineExample - Offline map regions
- QueryAtPoint - Query map features
- TakeSnapshot - Map snapshots
Example Structure
Each example follows a consistent pattern:Source Code Location
All examples are located in the repository at:GitHub Repository
View all examples on GitHub: https://github.com/rnmapbox/maps/tree/main/example/src/examplesLearning Path
We recommend exploring examples in this order:- Basic Map - Start with simple map rendering
- Custom Styles - Learn to customize map appearance
- Markers & Annotations - Add interactive elements
- Data Visualization - Display complex datasets
- Animations - Create dynamic experiences
Next Steps
Basic Map
Learn the fundamentals of rendering maps
Custom Styles
Customize your map’s appearance
Markers
Add markers and annotations
Data Visualization
Visualize complex datasets