expo-gaode-map 2.0.0-alpha.6 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DEPLOY_DOCS.md +209 -0
- package/PUBLISHING.md +173 -155
- package/README.en.md +1 -25
- package/README.md +26 -456
- package/RELEASE_CHECKLIST.md +146 -0
- package/RELEASE_v2.0.0.md +59 -0
- package/app.plugin.js +11 -0
- package/ios/modules/LocationManager.swift +4 -3
- package/package.json +8 -5
- package/plugin/README.md +52 -0
- package/plugin/build/withGaodeMap.d.ts +20 -0
- package/plugin/build/withGaodeMap.js +147 -0
- package/plugin/tsconfig.tsbuildinfo +1 -0
- package/docs/API.en.md +0 -408
- package/docs/API.md +0 -494
- package/docs/ARCHITECTURE.en.md +0 -423
- package/docs/ARCHITECTURE.md +0 -423
- package/docs/EXAMPLES.en.md +0 -651
- package/docs/EXAMPLES.md +0 -922
- package/docs/INITIALIZATION.en.md +0 -346
- package/docs/INITIALIZATION.md +0 -335
- package/docs/MIGRATION.md +0 -423
- package/docs/RELEASE_GUIDE.md +0 -178
package/README.md
CHANGED
|
@@ -2,22 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
[English](./README.en.md) | 简体中文
|
|
4
4
|
|
|
5
|
-
一个功能完整的高德地图 React Native 组件库,**基于 Expo Modules
|
|
6
|
-
- Android: [高德地图 Android SDK](https://lbs.amap.com/api/android-sdk/summary)
|
|
7
|
-
- iOS: [高德地图 iOS SDK](https://lbs.amap.com/api/ios-sdk/summary)
|
|
5
|
+
一个功能完整的高德地图 React Native 组件库,**基于 Expo Modules 开发**,提供地图显示、定位、覆盖物等功能。
|
|
8
6
|
|
|
9
7
|
> 💡 本组件使用 [Expo Modules API](https://docs.expo.dev/modules/overview/) 构建,提供了类型安全的原生模块接口和优秀的开发体验。
|
|
10
8
|
|
|
11
|
-
##
|
|
9
|
+
## 📖 完整文档
|
|
10
|
+
|
|
11
|
+
**👉 [在线文档网站](https://TomWq.github.io/expo-gaode-map/)** - 包含完整的 API 文档、使用指南和示例代码
|
|
12
|
+
|
|
13
|
+
## ✨ 主要特性
|
|
12
14
|
|
|
13
15
|
- ✅ 完整的地图功能(多种地图类型、手势控制、相机操作)
|
|
14
16
|
- ✅ 精准定位(连续定位、单次定位、坐标转换)
|
|
15
|
-
- ✅ 丰富的覆盖物(Circle、Marker、Polyline、Polygon
|
|
16
|
-
- ✅ 完整的 TypeScript
|
|
17
|
-
- ✅ 模块化架构设计
|
|
18
|
-
- ✅ 同时支持声明式组件和命令式 API(注意:命令式 API 将在未来的版本删除,建议使用声明式组件)
|
|
17
|
+
- ✅ 丰富的覆盖物(Circle、Marker、Polyline、Polygon、HeatMap、Cluster 等)
|
|
18
|
+
- ✅ 完整的 TypeScript 类型定义
|
|
19
19
|
- ✅ 跨平台支持(Android、iOS)
|
|
20
|
-
- ✅ 支持自定义样式和事件监听
|
|
21
20
|
- ✅ 同时支持 React Native 新旧架构(Paper & Fabric)
|
|
22
21
|
|
|
23
22
|
## 📦 安装
|
|
@@ -32,91 +31,21 @@ yarn add expo-gaode-map
|
|
|
32
31
|
pnpm add expo-gaode-map
|
|
33
32
|
```
|
|
34
33
|
|
|
35
|
-
### 体验 2.0 测试版本 🚀
|
|
36
|
-
|
|
37
|
-
> ⚠️ **重要提示**: 2.0 版本包含破坏性变更,API 调用方式有重大调整。详见 [迁移指南](docs/MIGRATION.md)
|
|
38
|
-
|
|
39
|
-
如果你想体验最新的 2.0 alpha 版本(包含改进的架构和更好的类型支持):
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
npm install expo-gaode-map@next
|
|
43
|
-
# 或
|
|
44
|
-
yarn add expo-gaode-map@next
|
|
45
|
-
# 或
|
|
46
|
-
pnpm add expo-gaode-map@next
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
**2.0 版本主要变化:**
|
|
50
|
-
- ✅ 统一的 API 调用方式(`ExpoGaodeMapModule`)
|
|
51
|
-
- ✅ 完整的 TypeScript 类型支持
|
|
52
|
-
- ✅ 移除了多余的封装层,直接调用原生模块
|
|
53
|
-
- ✅ 完全移除命令式 API的支持
|
|
54
|
-
- ✅ 添加未实现的一些新的 API(如:onCameraMove、onCameraIdle)
|
|
55
|
-
- ⚠️ **不向后兼容**,需要按照 [迁移指南](docs/MIGRATION.md) 更新代码
|
|
56
|
-
|
|
57
|
-
**版本对比:**
|
|
58
|
-
- `1.x`(稳定版):`import { initSDK, start, stop } from 'expo-gaode-map'`
|
|
59
|
-
- `2.0`(测试版):`import { ExpoGaodeMapModule } from 'expo-gaode-map'`
|
|
60
|
-
|
|
61
|
-
### Expo 项目
|
|
62
|
-
|
|
63
|
-
如果你使用的是 Expo 管理的项目(使用 `expo prebuild` 或开发构建),安装后需要重新构建原生代码:
|
|
64
|
-
|
|
65
|
-
```bash
|
|
66
|
-
# 使用 EAS Build
|
|
67
|
-
eas build --platform android
|
|
68
|
-
|
|
69
|
-
# 或使用本地构建
|
|
70
|
-
npx expo prebuild
|
|
71
|
-
npx expo run:android
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
### 纯 React Native 项目
|
|
75
|
-
|
|
76
|
-
对于纯 React Native 项目(通过 `react-native init` 创建),确保已安装 `expo` 包作为依赖:
|
|
77
|
-
|
|
78
|
-
```bash
|
|
79
|
-
npm install expo
|
|
80
|
-
# 然后重新构建应用
|
|
81
|
-
npx react-native run-android
|
|
82
|
-
```
|
|
83
|
-
|
|
84
34
|
## 🚀 快速开始
|
|
85
35
|
|
|
86
36
|
### 1. 获取高德地图 API Key
|
|
87
37
|
|
|
88
38
|
前往 [高德开放平台](https://lbs.amap.com/) 注册并创建应用,获取 API Key。
|
|
89
39
|
|
|
90
|
-
> ⚠️
|
|
91
|
-
>
|
|
92
|
-
>
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
> 1. 在 `AndroidManifest.xml` 中配置 API Key
|
|
96
|
-
> 2. 添加必需权限(网络、定位等)
|
|
97
|
-
> 3. 配置隐私合规(必需)
|
|
98
|
-
>
|
|
99
|
-
> **iOS 必需配置:**
|
|
100
|
-
> 1. 在 `Info.plist` 中配置 API Key
|
|
101
|
-
> 2. 添加定位权限描述(NSLocationWhenInUseUsageDescription 等)
|
|
102
|
-
> 3. 配置隐私合规(必需)
|
|
103
|
-
>
|
|
104
|
-
> **详细配置指南:**
|
|
105
|
-
> - **Android**: [高德地图 Android SDK 配置指南](https://lbs.amap.com/api/android-sdk/guide/create-project/android-studio-create-project)
|
|
106
|
-
> - **iOS**: [高德地图 iOS SDK 配置指南](https://lbs.amap.com/api/ios-sdk/guide/create-project/cocoapods)
|
|
107
|
-
>
|
|
108
|
-
> 对于 Expo 项目,使用 `npx expo prebuild` 生成原生代码后进行配置。
|
|
109
|
-
|
|
110
|
-
### 2. 初始化和权限管理
|
|
111
|
-
|
|
112
|
-
**推荐的初始化流程**:
|
|
40
|
+
> ⚠️ **重要提示**: 高德地图 SDK 需要在原生项目中进行配置(API Key、权限、隐私合规等)
|
|
41
|
+
>
|
|
42
|
+
> 详细配置请查看:[初始化指南](https://TomWq.github.io/expo-gaode-map/guide/initialization.html)
|
|
43
|
+
|
|
44
|
+
### 2. 基础使用
|
|
113
45
|
|
|
114
46
|
```tsx
|
|
115
47
|
import { useEffect, useState } from 'react';
|
|
116
|
-
import {
|
|
117
|
-
MapView,
|
|
118
|
-
ExpoGaodeMapModule,
|
|
119
|
-
} from 'expo-gaode-map';
|
|
48
|
+
import { MapView, ExpoGaodeMapModule } from 'expo-gaode-map';
|
|
120
49
|
|
|
121
50
|
export default function App() {
|
|
122
51
|
const [initialPosition, setInitialPosition] = useState(null);
|
|
@@ -166,372 +95,13 @@ export default function App() {
|
|
|
166
95
|
}
|
|
167
96
|
```
|
|
168
97
|
|
|
169
|
-
|
|
170
|
-
>
|
|
171
|
-
> 包含完整的权限处理、错误处理和最佳实践。
|
|
172
|
-
|
|
173
|
-
### 3. 基础地图使用
|
|
174
|
-
|
|
175
|
-
```tsx
|
|
176
|
-
import { MapView } from 'expo-gaode-map';
|
|
177
|
-
|
|
178
|
-
export default function MapScreen() {
|
|
179
|
-
return (
|
|
180
|
-
<MapView
|
|
181
|
-
style={{ flex: 1 }}
|
|
182
|
-
initialCameraPosition={{
|
|
183
|
-
target: { latitude: 39.9, longitude: 116.4 },
|
|
184
|
-
zoom: 10,
|
|
185
|
-
}}
|
|
186
|
-
myLocationEnabled={true}
|
|
187
|
-
onLoad={() => console.log('地图加载完成')}
|
|
188
|
-
/>
|
|
189
|
-
);
|
|
190
|
-
}
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
## 📚 功能概览
|
|
194
|
-
|
|
195
|
-
### 🗺️ 地图显示
|
|
196
|
-
- 多种地图类型(标准、卫星、夜间等)
|
|
197
|
-
- 相机控制(移动、缩放、旋转、倾斜)
|
|
198
|
-
- 手势控制和 UI 控件配置
|
|
199
|
-
- 缩放级别限制
|
|
200
|
-
|
|
201
|
-
### 📍 定位功能
|
|
202
|
-
- 连续定位和单次定位
|
|
203
|
-
- 逆地理编码(地址解析)
|
|
204
|
-
- 定位配置(精度、间隔、模式等)
|
|
205
|
-
- 自定义定位蓝点样式
|
|
206
|
-
|
|
207
|
-
### 🎨 覆盖物
|
|
208
|
-
- Circle(圆形)
|
|
209
|
-
- Marker(标记点)
|
|
210
|
-
- Polyline(折线)
|
|
211
|
-
- Polygon(多边形)
|
|
212
|
-
- 支持声明式和命令式两种使用方式
|
|
213
|
-
|
|
214
|
-
### 📝 更多示例
|
|
215
|
-
|
|
216
|
-
详细的使用示例请查看:[EXAMPLES.md](docs/EXAMPLES.md)
|
|
217
|
-
|
|
218
|
-
包含:
|
|
219
|
-
- 基础地图应用
|
|
220
|
-
- 定位追踪应用
|
|
221
|
-
- 覆盖物操作示例
|
|
222
|
-
- 高级用法和最佳实践
|
|
223
|
-
|
|
224
|
-
## 📝 文档
|
|
225
|
-
|
|
226
|
-
- [API 文档](docs/API.md) - 完整的 API 参考
|
|
227
|
-
- [使用示例](docs/EXAMPLES.md) - 详细的代码示例
|
|
228
|
-
- [初始化指南](docs/INITIALIZATION.md) - SDK 初始化和权限管理
|
|
229
|
-
- [架构文档](docs/ARCHITECTURE.md) - 项目结构和文件说明
|
|
230
|
-
- [迁移指南](docs/MIGRATION.md) - v1.x 到 v2.0 的迁移指南
|
|
231
|
-
|
|
232
|
-
## ⚠️ 注意事项
|
|
233
|
-
|
|
234
|
-
### 基础地图应用
|
|
235
|
-
|
|
236
|
-
```tsx
|
|
237
|
-
import React, { useRef, useEffect } from 'react';
|
|
238
|
-
import { View, StyleSheet, Button } from 'react-native';
|
|
239
|
-
import {
|
|
240
|
-
MapView,
|
|
241
|
-
ExpoGaodeMapModule,
|
|
242
|
-
Circle,
|
|
243
|
-
Marker,
|
|
244
|
-
Polyline,
|
|
245
|
-
Polygon,
|
|
246
|
-
type MapViewRef
|
|
247
|
-
} from 'expo-gaode-map';
|
|
248
|
-
|
|
249
|
-
export default function App() {
|
|
250
|
-
const mapRef = useRef<MapViewRef>(null);
|
|
251
|
-
|
|
252
|
-
useEffect(() => {
|
|
253
|
-
ExpoGaodeMapModule.initSDK({
|
|
254
|
-
androidKey: 'your-android-api-key',
|
|
255
|
-
iosKey: 'your-ios-api-key',
|
|
256
|
-
});
|
|
257
|
-
}, []);
|
|
258
|
-
|
|
259
|
-
const handleMoveCamera = async () => {
|
|
260
|
-
await mapRef.current?.moveCamera(
|
|
261
|
-
{
|
|
262
|
-
target: { latitude: 40.0, longitude: 116.5 },
|
|
263
|
-
zoom: 15,
|
|
264
|
-
},
|
|
265
|
-
1000
|
|
266
|
-
);
|
|
267
|
-
};
|
|
268
|
-
|
|
269
|
-
return (
|
|
270
|
-
<View style={styles.container}>
|
|
271
|
-
<MapView
|
|
272
|
-
ref={mapRef}
|
|
273
|
-
style={styles.map}
|
|
274
|
-
initialCameraPosition={{
|
|
275
|
-
target: { latitude: 39.9, longitude: 116.4 },
|
|
276
|
-
zoom: 10,
|
|
277
|
-
}}
|
|
278
|
-
myLocationEnabled={true}
|
|
279
|
-
followUserLocation={false}
|
|
280
|
-
trafficEnabled={true}
|
|
281
|
-
onPress={(e) => console.log('点击地图', e)}
|
|
282
|
-
onLoad={() => console.log('地图加载完成')}
|
|
283
|
-
>
|
|
284
|
-
{/* 圆形覆盖物 */}
|
|
285
|
-
<Circle
|
|
286
|
-
center={{ latitude: 39.9, longitude: 116.4 }}
|
|
287
|
-
radius={1000}
|
|
288
|
-
fillColor="#8800FF00"
|
|
289
|
-
strokeColor="#FFFF0000"
|
|
290
|
-
strokeWidth={2}
|
|
291
|
-
/>
|
|
292
|
-
|
|
293
|
-
{/* 标记点 */}
|
|
294
|
-
<Marker
|
|
295
|
-
position={{ latitude: 39.95, longitude: 116.45 }}
|
|
296
|
-
title="这是一个标记"
|
|
297
|
-
draggable={true}
|
|
298
|
-
/>
|
|
299
|
-
|
|
300
|
-
{/* 折线 */}
|
|
301
|
-
<Polyline
|
|
302
|
-
points={[
|
|
303
|
-
{ latitude: 39.9, longitude: 116.4 },
|
|
304
|
-
{ latitude: 39.95, longitude: 116.45 },
|
|
305
|
-
{ latitude: 40.0, longitude: 116.5 },
|
|
306
|
-
]}
|
|
307
|
-
strokeWidth={5}
|
|
308
|
-
strokeColor="#FF0000FF"
|
|
309
|
-
/>
|
|
310
|
-
|
|
311
|
-
{/* 多边形 */}
|
|
312
|
-
<Polygon
|
|
313
|
-
points={[
|
|
314
|
-
{ latitude: 39.85, longitude: 116.35 },
|
|
315
|
-
{ latitude: 39.85, longitude: 116.45 },
|
|
316
|
-
{ latitude: 39.75, longitude: 116.40 },
|
|
317
|
-
]}
|
|
318
|
-
fillColor="#880000FF"
|
|
319
|
-
strokeColor="#FFFF0000"
|
|
320
|
-
strokeWidth={2}
|
|
321
|
-
/>
|
|
322
|
-
</MapView>
|
|
323
|
-
|
|
324
|
-
<View style={styles.controls}>
|
|
325
|
-
<Button title="移动相机" onPress={handleMoveCamera} />
|
|
326
|
-
</View>
|
|
327
|
-
</View>
|
|
328
|
-
);
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
const styles = StyleSheet.create({
|
|
332
|
-
container: {
|
|
333
|
-
flex: 1,
|
|
334
|
-
},
|
|
335
|
-
map: {
|
|
336
|
-
flex: 1,
|
|
337
|
-
},
|
|
338
|
-
controls: {
|
|
339
|
-
position: 'absolute',
|
|
340
|
-
bottom: 20,
|
|
341
|
-
left: 20,
|
|
342
|
-
right: 20,
|
|
343
|
-
},
|
|
344
|
-
});
|
|
345
|
-
```
|
|
346
|
-
|
|
347
|
-
### 定位追踪应用
|
|
348
|
-
|
|
349
|
-
```tsx
|
|
350
|
-
import React, { useEffect, useState } from 'react';
|
|
351
|
-
import { View, Text, Button, StyleSheet } from 'react-native';
|
|
352
|
-
import {
|
|
353
|
-
MapView,
|
|
354
|
-
ExpoGaodeMapModule,
|
|
355
|
-
type Location,
|
|
356
|
-
} from 'expo-gaode-map';
|
|
357
|
-
|
|
358
|
-
export default function LocationApp() {
|
|
359
|
-
const [location, setLocation] = useState<Location | null>(null);
|
|
360
|
-
const [isTracking, setIsTracking] = useState(false);
|
|
361
|
-
|
|
362
|
-
useEffect(() => {
|
|
363
|
-
// 初始化 SDK
|
|
364
|
-
ExpoGaodeMapModule.initSDK({
|
|
365
|
-
androidKey: 'your-android-api-key',
|
|
366
|
-
iosKey: 'your-ios-api-key',
|
|
367
|
-
});
|
|
368
|
-
|
|
369
|
-
// 配置定位参数
|
|
370
|
-
ExpoGaodeMapModule.setLocatingWithReGeocode(true); // 返回地址信息
|
|
371
|
-
ExpoGaodeMapModule.setLocationMode(0); // 高精度模式
|
|
372
|
-
ExpoGaodeMapModule.setInterval(2000); // 2秒更新一次
|
|
373
|
-
|
|
374
|
-
// 监听位置更新
|
|
375
|
-
const subscription = ExpoGaodeMapModule.addLocationListener('onLocationUpdate', (loc) => {
|
|
376
|
-
console.log('位置更新:', loc);
|
|
377
|
-
setLocation(loc);
|
|
378
|
-
});
|
|
379
|
-
|
|
380
|
-
return () => subscription.remove();
|
|
381
|
-
}, []);
|
|
382
|
-
|
|
383
|
-
const handleStartTracking = () => {
|
|
384
|
-
ExpoGaodeMapModule.start();
|
|
385
|
-
setIsTracking(true);
|
|
386
|
-
};
|
|
387
|
-
|
|
388
|
-
const handleStopTracking = () => {
|
|
389
|
-
ExpoGaodeMapModule.stop();
|
|
390
|
-
setIsTracking(false);
|
|
391
|
-
};
|
|
392
|
-
|
|
393
|
-
const handleGetLocation = async () => {
|
|
394
|
-
try {
|
|
395
|
-
const loc = await ExpoGaodeMapModule.getCurrentLocation();
|
|
396
|
-
setLocation(loc);
|
|
397
|
-
} catch (error) {
|
|
398
|
-
console.error('获取位置失败:', error);
|
|
399
|
-
}
|
|
400
|
-
};
|
|
401
|
-
|
|
402
|
-
return (
|
|
403
|
-
<View style={styles.container}>
|
|
404
|
-
<MapView
|
|
405
|
-
style={styles.map}
|
|
406
|
-
myLocationEnabled={true}
|
|
407
|
-
followUserLocation={isTracking}
|
|
408
|
-
initialCameraPosition={{
|
|
409
|
-
target: {
|
|
410
|
-
latitude: location?.latitude || 39.9,
|
|
411
|
-
longitude: location?.longitude || 116.4
|
|
412
|
-
},
|
|
413
|
-
zoom: 15,
|
|
414
|
-
}}
|
|
415
|
-
/>
|
|
416
|
-
|
|
417
|
-
{location && (
|
|
418
|
-
<View style={styles.info}>
|
|
419
|
-
<Text style={styles.infoText}>
|
|
420
|
-
纬度: {location.latitude.toFixed(6)}
|
|
421
|
-
</Text>
|
|
422
|
-
<Text style={styles.infoText}>
|
|
423
|
-
经度: {location.longitude.toFixed(6)}
|
|
424
|
-
</Text>
|
|
425
|
-
<Text style={styles.infoText}>
|
|
426
|
-
精度: {location.accuracy.toFixed(2)} 米
|
|
427
|
-
</Text>
|
|
428
|
-
{location.address && (
|
|
429
|
-
<Text style={styles.infoText}>
|
|
430
|
-
地址: {location.address}
|
|
431
|
-
</Text>
|
|
432
|
-
)}
|
|
433
|
-
</View>
|
|
434
|
-
)}
|
|
435
|
-
|
|
436
|
-
<View style={styles.controls}>
|
|
437
|
-
<Button
|
|
438
|
-
title="获取位置"
|
|
439
|
-
onPress={handleGetLocation}
|
|
440
|
-
/>
|
|
441
|
-
<View style={{ height: 10 }} />
|
|
442
|
-
<Button
|
|
443
|
-
title={isTracking ? '停止追踪' : '开始追踪'}
|
|
444
|
-
onPress={isTracking ? handleStopTracking : handleStartTracking}
|
|
445
|
-
color={isTracking ? '#FF3B30' : '#007AFF'}
|
|
446
|
-
/>
|
|
447
|
-
</View>
|
|
448
|
-
</View>
|
|
449
|
-
);
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
const styles = StyleSheet.create({
|
|
453
|
-
container: {
|
|
454
|
-
flex: 1,
|
|
455
|
-
},
|
|
456
|
-
map: {
|
|
457
|
-
flex: 1,
|
|
458
|
-
},
|
|
459
|
-
info: {
|
|
460
|
-
position: 'absolute',
|
|
461
|
-
top: 50,
|
|
462
|
-
left: 20,
|
|
463
|
-
right: 20,
|
|
464
|
-
backgroundColor: 'white',
|
|
465
|
-
padding: 15,
|
|
466
|
-
borderRadius: 10,
|
|
467
|
-
shadowColor: '#000',
|
|
468
|
-
shadowOffset: { width: 0, height: 2 },
|
|
469
|
-
shadowOpacity: 0.25,
|
|
470
|
-
shadowRadius: 3.84,
|
|
471
|
-
elevation: 5,
|
|
472
|
-
},
|
|
473
|
-
infoText: {
|
|
474
|
-
fontSize: 14,
|
|
475
|
-
marginBottom: 5,
|
|
476
|
-
color: '#333',
|
|
477
|
-
},
|
|
478
|
-
controls: {
|
|
479
|
-
position: 'absolute',
|
|
480
|
-
bottom: 30,
|
|
481
|
-
left: 20,
|
|
482
|
-
right: 20,
|
|
483
|
-
},
|
|
484
|
-
});
|
|
485
|
-
```
|
|
486
|
-
|
|
487
|
-
## 🎨 高级用法
|
|
488
|
-
|
|
489
|
-
### followUserLocation 详解
|
|
490
|
-
|
|
491
|
-
`followUserLocation` 控制地图是否自动跟随用户位置移动:
|
|
492
|
-
|
|
493
|
-
**浏览模式(默认 - `false`):**
|
|
494
|
-
```tsx
|
|
495
|
-
<MapView
|
|
496
|
-
myLocationEnabled={true}
|
|
497
|
-
followUserLocation={false} // 或省略
|
|
498
|
-
/>
|
|
499
|
-
```
|
|
500
|
-
- ✅ 显示定位点
|
|
501
|
-
- ✅ 用户可自由滑动地图
|
|
502
|
-
- ✅ 地图不会自动移动
|
|
503
|
-
|
|
504
|
-
**导航模式(`true`):**
|
|
505
|
-
```tsx
|
|
506
|
-
<MapView
|
|
507
|
-
myLocationEnabled={true}
|
|
508
|
-
followUserLocation={true}
|
|
509
|
-
/>
|
|
510
|
-
```
|
|
511
|
-
- ✅ 显示定位点
|
|
512
|
-
- ✅ 地图自动跟随用户移动
|
|
513
|
-
- ⚠️ 适合导航场景
|
|
514
|
-
|
|
515
|
-
详细说明请参考:[docs/followUserLocation.md](docs/followUserLocation.md)
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
### 颜色格式
|
|
520
|
-
|
|
521
|
-
覆盖物颜色支持两种格式:
|
|
522
|
-
|
|
523
|
-
1. **字符串格式**(ARGB):`"#AARRGGBB"`
|
|
524
|
-
```tsx
|
|
525
|
-
<Circle fillColor="#8800FF00" /> // 50% 透明绿色
|
|
526
|
-
```
|
|
527
|
-
```
|
|
528
|
-
|
|
529
|
-
### 性能优化
|
|
98
|
+
## 📚 文档导航
|
|
530
99
|
|
|
531
|
-
-
|
|
532
|
-
-
|
|
533
|
-
-
|
|
534
|
-
-
|
|
100
|
+
- [快速开始](https://TomWq.github.io/expo-gaode-map/guide/getting-started.html) - 快速上手指南
|
|
101
|
+
- [初始化指南](https://TomWq.github.io/expo-gaode-map/guide/initialization.html) - SDK 初始化和权限配置
|
|
102
|
+
- [API 文档](https://TomWq.github.io/expo-gaode-map/api/) - 完整的 API 参考
|
|
103
|
+
- [使用示例](https://TomWq.github.io/expo-gaode-map/examples/) - 详细的代码示例
|
|
104
|
+
- [架构文档](https://TomWq.github.io/expo-gaode-map/guide/architecture.html) - 项目结构说明
|
|
535
105
|
|
|
536
106
|
## 🤝 贡献
|
|
537
107
|
|
|
@@ -543,18 +113,18 @@ MIT
|
|
|
543
113
|
|
|
544
114
|
## 🔗 相关链接
|
|
545
115
|
|
|
116
|
+
- [在线文档](https://TomWq.github.io/expo-gaode-map/)
|
|
117
|
+
- [GitHub 仓库](https://github.com/TomWq/expo-gaode-map)
|
|
546
118
|
- [高德地图开放平台](https://lbs.amap.com/)
|
|
547
|
-
- [高德地图 Android SDK](https://lbs.amap.com/api/android-sdk/summary)
|
|
548
119
|
- [Expo Modules API](https://docs.expo.dev/modules/overview/)
|
|
549
|
-
- [GitHub 仓库](https://github.com/yourusername/expo-gaode-map)
|
|
550
120
|
|
|
551
121
|
## 🙏 致谢
|
|
552
122
|
|
|
553
|
-
|
|
123
|
+
本项目在开发过程中参考了以下优秀项目:
|
|
554
124
|
|
|
555
|
-
- **[react-native-amap3d](https://github.com/qiuxiang/react-native-amap3d)** - 一个优秀的 React Native
|
|
125
|
+
- **[react-native-amap3d](https://github.com/qiuxiang/react-native-amap3d)** - 一个优秀的 React Native 高德地图组件
|
|
556
126
|
|
|
557
|
-
|
|
127
|
+
感谢这些开源项目的贡献者们!
|
|
558
128
|
|
|
559
129
|
## 📮 反馈与支持
|
|
560
130
|
|
|
@@ -563,4 +133,4 @@ MIT
|
|
|
563
133
|
- 📝 提交 [GitHub Issue](https://github.com/TomWq/expo-gaode-map/issues)
|
|
564
134
|
- 💬 参与 [Discussions](https://github.com/TomWq/expo-gaode-map/discussions)
|
|
565
135
|
- ⭐ 给项目点个 Star 支持一下
|
|
566
|
-
- 💬 加入 QQ 群:952241387
|
|
136
|
+
- 💬 加入 QQ 群:952241387
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# 🚀 发布检查清单
|
|
2
|
+
|
|
3
|
+
快速参考 - 发布新版本时需要执行的命令
|
|
4
|
+
|
|
5
|
+
## 📋 发布前检查
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# 1. 确保在主分支且代码最新
|
|
9
|
+
git checkout main
|
|
10
|
+
git pull origin main
|
|
11
|
+
|
|
12
|
+
# 2. 确保没有未提交的更改
|
|
13
|
+
git status
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## 🔨 构建和测试
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# 1. 清理旧的构建产物
|
|
20
|
+
npm run clean
|
|
21
|
+
|
|
22
|
+
# 2. 安装依赖(如果需要)
|
|
23
|
+
npm install
|
|
24
|
+
|
|
25
|
+
# 3. 构建项目(包含主模块和 Config Plugin)
|
|
26
|
+
npm run build
|
|
27
|
+
|
|
28
|
+
# 4. 运行测试
|
|
29
|
+
npm test
|
|
30
|
+
|
|
31
|
+
# 5. 运行 lint 检查
|
|
32
|
+
npm run lint
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## 📝 更新版本信息
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# 选择一个版本更新命令:
|
|
39
|
+
|
|
40
|
+
# Patch 版本 (1.0.0 -> 1.0.1) - 修复 bug
|
|
41
|
+
npm version patch
|
|
42
|
+
|
|
43
|
+
# Minor 版本 (1.0.0 -> 1.1.0) - 新增功能
|
|
44
|
+
npm version minor
|
|
45
|
+
|
|
46
|
+
# Major 版本 (1.0.0 -> 2.0.0) - 破坏性更新
|
|
47
|
+
npm version major
|
|
48
|
+
|
|
49
|
+
# 或手动编辑 package.json 中的 version 字段
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## 📦 发布到 npm
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# 发布稳定版本(推荐)
|
|
56
|
+
npm run publish:latest
|
|
57
|
+
|
|
58
|
+
# 或发布预览版本(alpha/beta)
|
|
59
|
+
npm run publish:next
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## 🏷️ 创建 Git 标签
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# 自动创建(如果使用 npm version 命令会自动创建标签)
|
|
66
|
+
# 或手动创建:
|
|
67
|
+
|
|
68
|
+
git tag -a v2.0.0 -m "Release v2.0.0"
|
|
69
|
+
git push origin v2.0.0
|
|
70
|
+
git push origin main
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## 📄 完整命令序列(复制粘贴)
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# === 稳定版发布 ===
|
|
77
|
+
npm run clean && \
|
|
78
|
+
npm run build && \
|
|
79
|
+
npm test && \
|
|
80
|
+
npm run lint && \
|
|
81
|
+
npm version patch && \
|
|
82
|
+
npm run publish:latest && \
|
|
83
|
+
git push origin main && \
|
|
84
|
+
git push --tags
|
|
85
|
+
|
|
86
|
+
# === 预览版发布 ===
|
|
87
|
+
npm run clean && \
|
|
88
|
+
npm run build && \
|
|
89
|
+
npm test && \
|
|
90
|
+
npm run lint && \
|
|
91
|
+
npm version prerelease --preid=alpha && \
|
|
92
|
+
npm run publish:next && \
|
|
93
|
+
git push origin main && \
|
|
94
|
+
git push --tags
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## ✅ 发布后验证
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# 1. 检查 npm 上的版本
|
|
101
|
+
npm view expo-gaode-map version
|
|
102
|
+
|
|
103
|
+
# 2. 在测试项目中安装新版本
|
|
104
|
+
cd /path/to/test-project
|
|
105
|
+
npm install expo-gaode-map@latest
|
|
106
|
+
|
|
107
|
+
# 3. 验证 Config Plugin 是否工作
|
|
108
|
+
npx expo prebuild
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## 🔙 回滚(如有问题)
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
# 废弃有问题的版本
|
|
115
|
+
npm deprecate expo-gaode-map@版本号 "此版本存在问题,请使用 x.x.x 版本"
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## 📊 检查清单
|
|
119
|
+
|
|
120
|
+
- [ ] 代码已提交且推送到 main 分支
|
|
121
|
+
- [ ] 运行 `npm run clean`
|
|
122
|
+
- [ ] 运行 `npm run build` 成功
|
|
123
|
+
- [ ] 运行 `npm test` 通过
|
|
124
|
+
- [ ] 运行 `npm run lint` 无错误
|
|
125
|
+
- [ ] 确认 `build/` 目录存在
|
|
126
|
+
- [ ] 确认 `plugin/build/` 目录存在
|
|
127
|
+
- [ ] 更新了 CHANGELOG.md
|
|
128
|
+
- [ ] 版本号已更新
|
|
129
|
+
- [ ] 发布到 npm 成功
|
|
130
|
+
- [ ] Git 标签已创建并推送
|
|
131
|
+
- [ ] 在 GitHub 创建了 Release
|
|
132
|
+
- [ ] 测试项目中验证新版本可用
|
|
133
|
+
|
|
134
|
+
## 💡 常用版本号规则
|
|
135
|
+
|
|
136
|
+
| 类型 | 命令 | 示例 | 说明 |
|
|
137
|
+
|------|------|------|------|
|
|
138
|
+
| Patch | `npm version patch` | 1.0.0 → 1.0.1 | Bug 修复 |
|
|
139
|
+
| Minor | `npm version minor` | 1.0.0 → 1.1.0 | 新功能(向下兼容) |
|
|
140
|
+
| Major | `npm version major` | 1.0.0 → 2.0.0 | 破坏性更新 |
|
|
141
|
+
| Prerelease | `npm version prerelease --preid=alpha` | 1.0.0 → 1.0.1-alpha.0 | 预发布版本 |
|
|
142
|
+
|
|
143
|
+
## 🔗 相关文档
|
|
144
|
+
|
|
145
|
+
- 详细发布流程: [PUBLISHING.md](./PUBLISHING.md)
|
|
146
|
+
- 项目部署文档: [DEPLOY_DOCS.md](./DEPLOY_DOCS.md)
|