expo-gaode-map 0.1.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.
Files changed (132) hide show
  1. package/.eslintrc.js +5 -0
  2. package/PUBLISHING.md +244 -0
  3. package/README.md +990 -0
  4. package/android/build.gradle +48 -0
  5. package/android/src/main/AndroidManifest.xml +40 -0
  6. package/android/src/main/java/expo/modules/gaodemap/ExpoGaodeMapModule.kt +455 -0
  7. package/android/src/main/java/expo/modules/gaodemap/ExpoGaodeMapView.kt +337 -0
  8. package/android/src/main/java/expo/modules/gaodemap/managers/CameraManager.kt +128 -0
  9. package/android/src/main/java/expo/modules/gaodemap/managers/OverlayManager.kt +324 -0
  10. package/android/src/main/java/expo/modules/gaodemap/managers/UIManager.kt +122 -0
  11. package/android/src/main/java/expo/modules/gaodemap/modules/LocationManager.kt +247 -0
  12. package/android/src/main/java/expo/modules/gaodemap/modules/SDKInitializer.kt +45 -0
  13. package/android/src/main/java/expo/modules/gaodemap/overlays/CircleView.kt +151 -0
  14. package/android/src/main/java/expo/modules/gaodemap/overlays/ClusterView.kt +127 -0
  15. package/android/src/main/java/expo/modules/gaodemap/overlays/HeatMapView.kt +97 -0
  16. package/android/src/main/java/expo/modules/gaodemap/overlays/MarkerView.kt +204 -0
  17. package/android/src/main/java/expo/modules/gaodemap/overlays/MultiPointView.kt +103 -0
  18. package/android/src/main/java/expo/modules/gaodemap/overlays/PolygonView.kt +114 -0
  19. package/android/src/main/java/expo/modules/gaodemap/overlays/PolylineView.kt +138 -0
  20. package/build/ExpoGaodeMap.types.d.ts +24 -0
  21. package/build/ExpoGaodeMap.types.d.ts.map +1 -0
  22. package/build/ExpoGaodeMap.types.js +14 -0
  23. package/build/ExpoGaodeMap.types.js.map +1 -0
  24. package/build/ExpoGaodeMapModule.d.ts +7 -0
  25. package/build/ExpoGaodeMapModule.d.ts.map +1 -0
  26. package/build/ExpoGaodeMapModule.js +14 -0
  27. package/build/ExpoGaodeMapModule.js.map +1 -0
  28. package/build/ExpoGaodeMapView.d.ts +31 -0
  29. package/build/ExpoGaodeMapView.d.ts.map +1 -0
  30. package/build/ExpoGaodeMapView.js +141 -0
  31. package/build/ExpoGaodeMapView.js.map +1 -0
  32. package/build/components/overlays/Circle.d.ts +18 -0
  33. package/build/components/overlays/Circle.d.ts.map +1 -0
  34. package/build/components/overlays/Circle.js +63 -0
  35. package/build/components/overlays/Circle.js.map +1 -0
  36. package/build/components/overlays/Cluster.d.ts +22 -0
  37. package/build/components/overlays/Cluster.d.ts.map +1 -0
  38. package/build/components/overlays/Cluster.js +35 -0
  39. package/build/components/overlays/Cluster.js.map +1 -0
  40. package/build/components/overlays/HeatMap.d.ts +21 -0
  41. package/build/components/overlays/HeatMap.d.ts.map +1 -0
  42. package/build/components/overlays/HeatMap.js +34 -0
  43. package/build/components/overlays/HeatMap.js.map +1 -0
  44. package/build/components/overlays/Marker.d.ts +17 -0
  45. package/build/components/overlays/Marker.d.ts.map +1 -0
  46. package/build/components/overlays/Marker.js +57 -0
  47. package/build/components/overlays/Marker.js.map +1 -0
  48. package/build/components/overlays/MultiPoint.d.ts +21 -0
  49. package/build/components/overlays/MultiPoint.d.ts.map +1 -0
  50. package/build/components/overlays/MultiPoint.js +34 -0
  51. package/build/components/overlays/MultiPoint.js.map +1 -0
  52. package/build/components/overlays/Polygon.d.ts +22 -0
  53. package/build/components/overlays/Polygon.d.ts.map +1 -0
  54. package/build/components/overlays/Polygon.js +100 -0
  55. package/build/components/overlays/Polygon.js.map +1 -0
  56. package/build/components/overlays/Polyline.d.ts +20 -0
  57. package/build/components/overlays/Polyline.d.ts.map +1 -0
  58. package/build/components/overlays/Polyline.js +60 -0
  59. package/build/components/overlays/Polyline.js.map +1 -0
  60. package/build/components/overlays/index.d.ts +8 -0
  61. package/build/components/overlays/index.d.ts.map +1 -0
  62. package/build/components/overlays/index.js +18 -0
  63. package/build/components/overlays/index.js.map +1 -0
  64. package/build/index.d.ts +10 -0
  65. package/build/index.d.ts.map +1 -0
  66. package/build/index.js +28 -0
  67. package/build/index.js.map +1 -0
  68. package/build/modules/AMapLocation.d.ts +58 -0
  69. package/build/modules/AMapLocation.d.ts.map +1 -0
  70. package/build/modules/AMapLocation.js +141 -0
  71. package/build/modules/AMapLocation.js.map +1 -0
  72. package/build/modules/AMapSDK.d.ts +27 -0
  73. package/build/modules/AMapSDK.d.ts.map +1 -0
  74. package/build/modules/AMapSDK.js +43 -0
  75. package/build/modules/AMapSDK.js.map +1 -0
  76. package/build/modules/AMapView.d.ts +39 -0
  77. package/build/modules/AMapView.d.ts.map +1 -0
  78. package/build/modules/AMapView.js +61 -0
  79. package/build/modules/AMapView.js.map +1 -0
  80. package/build/types/common.types.d.ts +133 -0
  81. package/build/types/common.types.d.ts.map +1 -0
  82. package/build/types/common.types.js +31 -0
  83. package/build/types/common.types.js.map +1 -0
  84. package/build/types/index.d.ts +12 -0
  85. package/build/types/index.d.ts.map +1 -0
  86. package/build/types/index.js +17 -0
  87. package/build/types/index.js.map +1 -0
  88. package/build/types/location.types.d.ts +306 -0
  89. package/build/types/location.types.d.ts.map +1 -0
  90. package/build/types/location.types.js +93 -0
  91. package/build/types/location.types.js.map +1 -0
  92. package/build/types/map-view.types.d.ts +213 -0
  93. package/build/types/map-view.types.d.ts.map +1 -0
  94. package/build/types/map-view.types.js +6 -0
  95. package/build/types/map-view.types.js.map +1 -0
  96. package/build/types/overlays.types.d.ts +296 -0
  97. package/build/types/overlays.types.d.ts.map +1 -0
  98. package/build/types/overlays.types.js +6 -0
  99. package/build/types/overlays.types.js.map +1 -0
  100. package/build/types/sdk.types.d.ts +113 -0
  101. package/build/types/sdk.types.d.ts.map +1 -0
  102. package/build/types/sdk.types.js +6 -0
  103. package/build/types/sdk.types.js.map +1 -0
  104. package/docs/followUserLocation.md +186 -0
  105. package/expo-module.config.json +9 -0
  106. package/ios/ExpoGaodeMap.podspec +29 -0
  107. package/ios/ExpoGaodeMapModule.swift +48 -0
  108. package/ios/ExpoGaodeMapView.swift +38 -0
  109. package/package.json +45 -0
  110. package/src/ExpoGaodeMap.types.ts +68 -0
  111. package/src/ExpoGaodeMapModule.ts +21 -0
  112. package/src/ExpoGaodeMapView.tsx +151 -0
  113. package/src/components/overlays/Circle.tsx +73 -0
  114. package/src/components/overlays/Cluster.tsx +38 -0
  115. package/src/components/overlays/HeatMap.tsx +37 -0
  116. package/src/components/overlays/Marker.tsx +66 -0
  117. package/src/components/overlays/MultiPoint.tsx +37 -0
  118. package/src/components/overlays/Polygon.tsx +107 -0
  119. package/src/components/overlays/Polyline.tsx +69 -0
  120. package/src/components/overlays/index.ts +18 -0
  121. package/src/index.ts +55 -0
  122. package/src/modules/AMapLocation.ts +164 -0
  123. package/src/modules/AMapSDK.ts +48 -0
  124. package/src/modules/AMapView.ts +68 -0
  125. package/src/types/README.md +186 -0
  126. package/src/types/common.types.ts +155 -0
  127. package/src/types/index.ts +74 -0
  128. package/src/types/location.types.ts +364 -0
  129. package/src/types/map-view.types.ts +249 -0
  130. package/src/types/overlays.types.ts +346 -0
  131. package/src/types/sdk.types.ts +128 -0
  132. package/tsconfig.json +9 -0
@@ -0,0 +1,346 @@
1
+ /**
2
+ * 高德地图覆盖物相关类型定义
3
+ * 基于 Expo Modules API
4
+ */
5
+
6
+ import type { ImageSourcePropType, ViewStyle } from 'react-native';
7
+ import type { ColorValue, LatLng, Point } from './common.types';
8
+
9
+ /**
10
+ * 标记点属性
11
+ */
12
+ export interface MarkerProps {
13
+ /**
14
+ * 坐标
15
+ */
16
+ position: LatLng;
17
+
18
+ /**
19
+ * 图标
20
+ */
21
+ icon?: ImageSourcePropType;
22
+
23
+ /**
24
+ * 标题
25
+ */
26
+ title?: string;
27
+
28
+ /**
29
+ * 描述
30
+ */
31
+ snippet?: string;
32
+
33
+ /**
34
+ * 透明度 [0, 1]
35
+ * @platform android
36
+ */
37
+ opacity?: number;
38
+
39
+ /**
40
+ * 是否可拖拽
41
+ */
42
+ draggable?: boolean;
43
+
44
+ /**
45
+ * 是否平贴地图
46
+ * @platform android
47
+ */
48
+ flat?: boolean;
49
+
50
+ /**
51
+ * 层级
52
+ */
53
+ zIndex?: number;
54
+
55
+ /**
56
+ * 覆盖物锚点比例
57
+ * @platform android
58
+ */
59
+ anchor?: Point;
60
+
61
+ /**
62
+ * 覆盖物偏移位置
63
+ * @platform ios
64
+ */
65
+ centerOffset?: Point;
66
+
67
+ /**
68
+ * 自定义视图
69
+ */
70
+ children?: React.ReactNode;
71
+
72
+ /**
73
+ * 点击事件
74
+ */
75
+ onPress?: () => void;
76
+
77
+ /**
78
+ * 拖拽开始事件
79
+ */
80
+ onDragStart?: () => void;
81
+
82
+ /**
83
+ * 拖拽中事件
84
+ */
85
+ onDrag?: () => void;
86
+
87
+ /**
88
+ * 拖拽结束事件
89
+ */
90
+ onDragEnd?: (event: { nativeEvent: LatLng }) => void;
91
+ }
92
+
93
+ /**
94
+ * 折线属性
95
+ */
96
+ export interface PolylineProps {
97
+ /**
98
+ * 节点坐标数组
99
+ */
100
+ points: LatLng[];
101
+
102
+ /**
103
+ * 线宽
104
+ */
105
+ width?: number;
106
+
107
+ /**
108
+ * 线条颜色
109
+ */
110
+ color?: ColorValue;
111
+
112
+ /**
113
+ * 层级
114
+ */
115
+ zIndex?: number;
116
+
117
+ /**
118
+ * 分段颜色
119
+ */
120
+ colors?: ColorValue[];
121
+
122
+ /**
123
+ * 是否使用渐变色
124
+ */
125
+ gradient?: boolean;
126
+
127
+ /**
128
+ * 是否绘制大地线
129
+ */
130
+ geodesic?: boolean;
131
+
132
+ /**
133
+ * 是否绘制虚线
134
+ */
135
+ dotted?: boolean;
136
+
137
+ /**
138
+ * 点击事件
139
+ */
140
+ onPress?: () => void;
141
+ }
142
+
143
+ /**
144
+ * 多边形属性
145
+ */
146
+ export interface PolygonProps {
147
+ /**
148
+ * 节点坐标数组
149
+ */
150
+ points: LatLng[];
151
+
152
+ /**
153
+ * 边线宽度
154
+ */
155
+ strokeWidth?: number;
156
+
157
+ /**
158
+ * 边线颜色
159
+ */
160
+ strokeColor?: ColorValue;
161
+
162
+ /**
163
+ * 填充颜色
164
+ */
165
+ fillColor?: ColorValue;
166
+
167
+ /**
168
+ * 层级
169
+ */
170
+ zIndex?: number;
171
+
172
+ /**
173
+ * 点击事件
174
+ */
175
+ onPress?: () => void;
176
+ }
177
+
178
+ /**
179
+ * 圆形属性
180
+ */
181
+ export interface CircleProps {
182
+ /**
183
+ * 圆心坐标
184
+ */
185
+ center: LatLng;
186
+
187
+ /**
188
+ * 半径(米)
189
+ */
190
+ radius: number;
191
+
192
+ /**
193
+ * 边线宽度
194
+ */
195
+ strokeWidth?: number;
196
+
197
+ /**
198
+ * 边线颜色
199
+ */
200
+ strokeColor?: ColorValue;
201
+
202
+ /**
203
+ * 填充颜色
204
+ */
205
+ fillColor?: ColorValue;
206
+
207
+ /**
208
+ * 层级
209
+ */
210
+ zIndex?: number;
211
+
212
+ /**
213
+ * 点击事件
214
+ */
215
+ onPress?: () => void;
216
+ }
217
+
218
+ /**
219
+ * 热力图属性
220
+ */
221
+ export interface HeatMapProps {
222
+ /**
223
+ * 热力点数据
224
+ */
225
+ data: LatLng[];
226
+
227
+ /**
228
+ * 热力半径(米)
229
+ */
230
+ radius?: number;
231
+
232
+ /**
233
+ * 透明度 [0, 1]
234
+ */
235
+ opacity?: number;
236
+ }
237
+
238
+ /**
239
+ * 海量点标记项
240
+ */
241
+ export interface MultiPointItem extends LatLng {
242
+ /**
243
+ * 唯一标识
244
+ */
245
+ id?: string | number;
246
+
247
+ /**
248
+ * 自定义数据
249
+ */
250
+ data?: any;
251
+ }
252
+
253
+ /**
254
+ * 海量点属性
255
+ */
256
+ export interface MultiPointProps {
257
+ /**
258
+ * 点集合
259
+ */
260
+ items: MultiPointItem[];
261
+
262
+ /**
263
+ * 图标
264
+ */
265
+ icon?: ImageSourcePropType;
266
+
267
+ /**
268
+ * 点击事件
269
+ */
270
+ onPress?: (event: { nativeEvent: { index: number; item: MultiPointItem } }) => void;
271
+ }
272
+
273
+ /**
274
+ * 聚合点参数
275
+ */
276
+ export interface ClusterParams {
277
+ /**
278
+ * 唯一标识
279
+ */
280
+ id: number;
281
+
282
+ /**
283
+ * 包含的标记点数量
284
+ */
285
+ count: number;
286
+
287
+ /**
288
+ * 聚合点坐标
289
+ */
290
+ position: LatLng;
291
+ }
292
+
293
+ /**
294
+ * 聚合点项
295
+ */
296
+ export interface ClusterPoint {
297
+ /**
298
+ * 坐标
299
+ */
300
+ position: LatLng;
301
+
302
+ /**
303
+ * 自定义数据
304
+ */
305
+ properties?: any;
306
+ }
307
+
308
+ /**
309
+ * 聚合图层属性
310
+ */
311
+ export interface ClusterProps {
312
+ /**
313
+ * 聚合半径
314
+ */
315
+ radius?: number;
316
+
317
+ /**
318
+ * 聚合点样式
319
+ */
320
+ clusterStyle?: ViewStyle;
321
+
322
+ /**
323
+ * 聚合点文本样式
324
+ */
325
+ clusterTextStyle?: ViewStyle;
326
+
327
+ /**
328
+ * 坐标点列表
329
+ */
330
+ points: ClusterPoint[];
331
+
332
+ /**
333
+ * 渲染标记点
334
+ */
335
+ renderMarker: (item: ClusterPoint) => React.ReactNode;
336
+
337
+ /**
338
+ * 渲染聚合点
339
+ */
340
+ renderCluster?: (params: ClusterParams) => React.ReactNode;
341
+
342
+ /**
343
+ * 聚合点点击事件
344
+ */
345
+ onPress?: (params: ClusterParams) => void;
346
+ }
@@ -0,0 +1,128 @@
1
+ /**
2
+ * 高德地图 SDK 模块类型定义
3
+ * 基于 Expo Modules API
4
+ */
5
+
6
+ import type { LatLng } from './common.types';
7
+ import type {
8
+ Coordinates,
9
+ ReGeocode,
10
+ LocationOptions,
11
+ LocationListener,
12
+ CoordinateType
13
+ } from './location.types';
14
+
15
+ /**
16
+ * SDK 初始化配置
17
+ */
18
+ export interface SDKConfig {
19
+ /**
20
+ * iOS API Key
21
+ */
22
+ iosKey?: string;
23
+
24
+ /**
25
+ * Android API Key
26
+ */
27
+ androidKey?: string;
28
+ }
29
+
30
+ /**
31
+ * 高德地图 SDK 模块接口
32
+ */
33
+ export interface AMapSDKModule {
34
+ /**
35
+ * 初始化 SDK
36
+ * @param config SDK配置
37
+ */
38
+ initSDK(config: SDKConfig): void;
39
+
40
+ /**
41
+ * 获取 SDK 版本号
42
+ */
43
+ getVersion(): Promise<string>;
44
+
45
+ /**
46
+ * 设置 API Key(单平台)
47
+ * @param key API密钥
48
+ */
49
+ setApiKey(key: string): void;
50
+ }
51
+
52
+ /**
53
+ * 高德定位模块接口
54
+ */
55
+ export interface AMapLocationModule {
56
+ /**
57
+ * 配置定位选项
58
+ * @param options 定位配置选项
59
+ */
60
+ configure(options: LocationOptions): void;
61
+
62
+ /**
63
+ * 开始连续定位
64
+ */
65
+ start(): void;
66
+
67
+ /**
68
+ * 停止定位
69
+ */
70
+ stop(): void;
71
+
72
+ /**
73
+ * 是否正在定位
74
+ */
75
+ isStarted(): Promise<boolean>;
76
+
77
+ /**
78
+ * 获取当前位置(单次定位)
79
+ */
80
+ getCurrentLocation(): Promise<Coordinates | ReGeocode>;
81
+
82
+ /**
83
+ * 添加定位监听器
84
+ * @param listener 定位回调函数
85
+ * @returns 订阅对象,用于取消监听
86
+ */
87
+ addLocationListener(listener: LocationListener): { remove: () => void };
88
+
89
+ /**
90
+ * 坐标转换
91
+ * @param coordinate 待转换的坐标
92
+ * @param type 坐标系类型
93
+ */
94
+ coordinateConvert(coordinate: LatLng, type: CoordinateType): Promise<LatLng>;
95
+
96
+ /**
97
+ * 开始获取设备朝向
98
+ * @platform ios
99
+ */
100
+ startUpdatingHeading(): void;
101
+
102
+ /**
103
+ * 停止获取设备朝向
104
+ * @platform ios
105
+ */
106
+ stopUpdatingHeading(): void;
107
+ }
108
+
109
+ /**
110
+ * 模块事件类型
111
+ */
112
+ export interface ModuleEvents {
113
+ /**
114
+ * 定位更新事件
115
+ */
116
+ onLocationUpdate: (location: Coordinates | ReGeocode) => void;
117
+
118
+ /**
119
+ * 定位错误事件
120
+ */
121
+ onLocationError: (error: { code: number; message: string }) => void;
122
+
123
+ /**
124
+ * 朝向更新事件
125
+ * @platform ios
126
+ */
127
+ onHeadingUpdate: (heading: { magneticHeading: number; trueHeading: number }) => void;
128
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,9 @@
1
+ // @generated by expo-module-scripts
2
+ {
3
+ "extends": "expo-module-scripts/tsconfig.base",
4
+ "compilerOptions": {
5
+ "outDir": "./build"
6
+ },
7
+ "include": ["./src"],
8
+ "exclude": ["**/__mocks__/*", "**/__tests__/*", "**/__rsc_tests__/*"]
9
+ }