A fully-featured Amap (Gaode Map) React Native library, built with Expo Modules API, using Monorepo architecture. It provides complete functionality including map display, location, search, navigation, and Web API.
๐ก This library is built using Expo Modules API, providing type-safe native module interfaces and an excellent developer experience.
๐ Online Documentation ยท ๐ Example Repository
Includes complete API documentation, usage guides, and example code:
- Getting Started
- Initialization Guide
- Search Functionality
- Navigation Functionality
- Web API
- API Reference
- Usage Examples
- โ Complete map functionality (multiple map types, gesture controls, camera operations, offline maps)
- โ Precise location (continuous location, single location, coordinate conversion)
- โ Rich overlays (Circle, Marker, Polyline, Polygon, HeatMap, Cluster, etc.)
- โ Friendly error notification system (detailed solutions and documentation links)
- โ Complete TypeScript type definitions
- โ Cross-platform support (Android, iOS)
- โ Supports both new and old React Native architectures (Paper & Fabric)
- โ High test coverage (75.7%, 207 unit tests)
- โ User-friendly error notification system
- โ Custom Marker overlay support
- โ Optimized map loading by default to reduce memory usage
- ๐ Search Functionality (expo-gaode-map-search) - POI search, nearby search, keyword search, geocoding, etc.
- ๐งญ Navigation Functionality (expo-gaode-map-navigation) - Driving, walking, cycling, truck route planning, real-time navigation
- ๐ Web API (expo-gaode-map-web-api) - Pure JavaScript implementation of route planning, geocoding, POI search, etc.
npm install expo-gaode-map
# Optional modules
npm install expo-gaode-map-search # Search functionality
npm install expo-gaode-map-web-api # Web APInpm install expo-gaode-map-navigation # Includes map + navigation
# Optional modules
npm install expo-gaode-map-web-api # Web API
โ ๏ธ Important:expo-gaode-mapandexpo-gaode-map-navigationcannot be installed simultaneously due to SDK conflicts. Choose one.
Configure in app.json to automatically set up native API keys and permissions:
{
"expo": {
"plugins": [
[
"expo-gaode-map", // or "expo-gaode-map-navigation"
{
"androidKey": "your-android-key",
"iosKey": "your-ios-key"
}
]
]
}
}After configuration, rebuild:
npx expo prebuild --clean
npx expo run:android
npx expo run:iosFor detailed initialization and usage guides, please see:
| Feature | Core Package | Search Package | Navigation Package | Web API |
|---|---|---|---|---|
| Map Display | โ | โ | โ | โ |
| Location | โ | โ | โ | โ |
| Overlays | โ | โ | โ | โ |
| POI Search | โ | โ | โ | โ |
| Geocoding | โ | โ | โ | โ |
| Route Planning | โ | โ | โ | โ |
| Real-time Navigation | โ | โ | โ | โ |
| Platform | Native | Native | Native | Web/Native |
expo-gaode-map/
โโโ packages/
โ โโโ core/ # expo-gaode-map (Core package)
โ โ โโโ Map display, location, overlays
โ โโโ search/ # expo-gaode-map-search (Search package)
โ โ โโโ POI search, geocoding
โ โโโ navigation/ # expo-gaode-map-navigation (Navigation package)
โ โ โโโ Map + navigation (replaces core)
โ โโโ web-api/ # expo-gaode-map-web-api (Web API)
โ โโโ Pure JS route planning, etc.
โโโ Note: core and navigation cannot be installed together
- Only need map and location โ Install
expo-gaode-map - Need navigation functionality โ Install
expo-gaode-map-navigation(includes map functionality) - Cannot install both: Due to native SDK conflicts, you can only choose one
- Search package (
expo-gaode-map-search): Native implementation, better performance, requires native environment configuration - Web API (
expo-gaode-map-web-api): Pure JavaScript, no native configuration needed, better cross-platform compatibility
It's recommended to use Config Plugin for automatic configuration. See: Initialization Guide
expo-gaode-map provides a comprehensive error handling system:
import ExpoGaodeMapModule, { GaodeMapError, ErrorType } from 'expo-gaode-map';
try {
await ExpoGaodeMapModule.getCurrentLocation();
} catch (error) {
if (error instanceof GaodeMapError) {
console.error(error.message); // Friendly error message
console.log(error.solution); // Detailed solution
console.log(error.docUrl); // Related documentation link
}
}Complete Error Handling Guide: ERROR_HANDLING_GUIDE.md
Supported error types:
SDK_NOT_INITIALIZED- SDK not initializedINVALID_API_KEY- API key configuration errorPERMISSION_DENIED- Permission not grantedLOCATION_FAILED- Location failedMAP_VIEW_NOT_INITIALIZED- Map view not initialized- More error types...
Issues and Pull Requests are welcome!
MIT
- Online Documentation
- Error Handling Guide ๐
- GitHub Repository
- Example Project
- Amap Open Platform
- Expo Modules API
This project referenced the following excellent projects during development:
- react-native-amap3d - An excellent React Native Amap component
Thank you to all contributors of these open-source projects!
If you encounter any issues or have any suggestions during usage, please feel free to:
- ๐ Submit a GitHub Issue
- ๐ฌ Join Discussions
- โญ Give the project a Star to show your support
- ็พค๏ผ952241387 ๏ผๆฌข่ฟๅ ๅ ฅ๏ผไบคๆตไฝฟ็จ็ป้ชใ้ฎ้ขๅ้ฆ็ญ๏ผ