expo-gaode-map-navigation 1.1.0 → 1.1.1
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/build/ExpoGaodeMapNaviView.js +0 -10
- package/build/map/ExpoGaodeMapModule.js +5 -5
- package/build/map/components/overlays/Cluster.js +0 -10
- package/build/map/components/overlays/HeatMap.js +0 -10
- package/build/map/components/overlays/MultiPoint.js +0 -10
- package/build/map/index.d.ts +1 -1
- package/build/map/index.js +3 -1
- package/package.json +15 -6
- package/package.json.backup +0 -47
- package/plugin/README.md +0 -52
- package/plugin/src/withGaodeMap.ts +0 -231
- package/plugin/tsconfig.tsbuildinfo +0 -1
- package/src/ExpoGaodeMapNaviView.tsx +0 -94
- package/src/ExpoGaodeMapNavigation.types.ts +0 -3
- package/src/ExpoGaodeMapNavigationModule.ts +0 -11
- package/src/index.ts +0 -262
- package/src/map/ExpoGaodeMap.types.ts +0 -46
- package/src/map/ExpoGaodeMapModule.ts +0 -315
- package/src/map/ExpoGaodeMapView.tsx +0 -120
- package/src/map/components/overlays/Circle.tsx +0 -20
- package/src/map/components/overlays/Cluster.tsx +0 -26
- package/src/map/components/overlays/HeatMap.tsx +0 -27
- package/src/map/components/overlays/Marker.tsx +0 -88
- package/src/map/components/overlays/MultiPoint.tsx +0 -27
- package/src/map/components/overlays/Polygon.tsx +0 -19
- package/src/map/components/overlays/Polyline.tsx +0 -19
- package/src/map/components/overlays/index.ts +0 -7
- package/src/map/index.ts +0 -37
- package/src/map/types/common.types.ts +0 -126
- package/src/map/types/index.ts +0 -55
- package/src/map/types/location.types.ts +0 -368
- package/src/map/types/map-view.types.ts +0 -281
- package/src/map/types/overlays.types.ts +0 -404
- package/src/map/utils/EventManager.ts +0 -23
- package/src/map/utils/ModuleLoader.ts +0 -115
- package/src/types/coordinates.types.ts +0 -25
- package/src/types/independent.types.ts +0 -288
- package/src/types/index.ts +0 -5
- package/src/types/naviview.types.ts +0 -330
- package/src/types/route.types.ts +0 -305
|
@@ -1,404 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 高德地图覆盖物相关类型定义
|
|
3
|
-
* 基于 Expo Modules API
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import type { ImageSourcePropType, ViewStyle, NativeSyntheticEvent } 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?: string | ImageSourcePropType;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* 图标宽度(像素)
|
|
25
|
-
* 仅在使用 icon 属性时有效
|
|
26
|
-
*/
|
|
27
|
-
iconWidth?: number;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* 图标高度(像素)
|
|
31
|
-
* 仅在使用 icon 属性时有效
|
|
32
|
-
*/
|
|
33
|
-
iconHeight?: number;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* 标题
|
|
37
|
-
*/
|
|
38
|
-
title?: string;
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* 描述
|
|
42
|
-
*/
|
|
43
|
-
snippet?: string;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* 透明度 [0, 1]
|
|
47
|
-
* @platform android
|
|
48
|
-
* @note iOS 不支持
|
|
49
|
-
*/
|
|
50
|
-
opacity?: number;
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* 是否可拖拽
|
|
54
|
-
*/
|
|
55
|
-
draggable?: boolean;
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* 是否平贴地图
|
|
59
|
-
* @platform android
|
|
60
|
-
* @note iOS 不支持
|
|
61
|
-
*/
|
|
62
|
-
flat?: boolean;
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* 层级
|
|
66
|
-
* @platform android
|
|
67
|
-
* @note iOS 不支持 (使用 displayPriority)
|
|
68
|
-
*/
|
|
69
|
-
zIndex?: number;
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* 覆盖物锚点比例
|
|
73
|
-
* @platform android
|
|
74
|
-
* @note iOS 使用 centerOffset
|
|
75
|
-
*/
|
|
76
|
-
anchor?: Point;
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* 覆盖物偏移位置
|
|
80
|
-
* @platform ios
|
|
81
|
-
*/
|
|
82
|
-
centerOffset?: Point;
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* 是否显示动画
|
|
86
|
-
* @platform ios
|
|
87
|
-
*/
|
|
88
|
-
animatesDrop?: boolean;
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* 大头针颜色
|
|
92
|
-
* Android 支持更多颜色,iOS 只支持 red, green, purple
|
|
93
|
-
*/
|
|
94
|
-
pinColor?: 'red' | 'orange' | 'yellow' | 'green' | 'cyan' | 'blue' | 'violet' | 'magenta' | 'rose' | 'purple';
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* 自定义视图
|
|
98
|
-
* 当使用 children 时,会将 React Native 组件渲染为图片显示在地图上
|
|
99
|
-
*/
|
|
100
|
-
children?: React.ReactNode;
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* 自定义视图宽度(像素)
|
|
104
|
-
* 仅在使用 children 属性时有效
|
|
105
|
-
* @default 80
|
|
106
|
-
*/
|
|
107
|
-
customViewWidth?: number;
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* 自定义视图高度(像素)
|
|
111
|
-
* 仅在使用 children 属性时有效
|
|
112
|
-
* @default 30
|
|
113
|
-
*/
|
|
114
|
-
customViewHeight?: number;
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* 点击事件
|
|
118
|
-
*/
|
|
119
|
-
onMarkerPress?: (event: NativeSyntheticEvent<LatLng>) => void;
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* 拖拽开始事件
|
|
123
|
-
*/
|
|
124
|
-
onMarkerDragStart?: (event: NativeSyntheticEvent<LatLng>) => void;
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* 拖拽中事件
|
|
128
|
-
*/
|
|
129
|
-
onMarkerDrag?: (event: NativeSyntheticEvent<LatLng>) => void;
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* 拖拽结束事件
|
|
133
|
-
*/
|
|
134
|
-
onMarkerDragEnd?: (event: NativeSyntheticEvent<LatLng>) => void;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* 折线属性
|
|
139
|
-
*/
|
|
140
|
-
export interface PolylineProps {
|
|
141
|
-
/**
|
|
142
|
-
* 节点坐标数组
|
|
143
|
-
*/
|
|
144
|
-
points: LatLng[];
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* 线宽
|
|
148
|
-
*/
|
|
149
|
-
strokeWidth?: number;
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* 线条颜色
|
|
153
|
-
*/
|
|
154
|
-
strokeColor?: ColorValue;
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* 层级
|
|
158
|
-
*/
|
|
159
|
-
zIndex?: number;
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* 分段颜色
|
|
163
|
-
*/
|
|
164
|
-
colors?: ColorValue[];
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* 是否使用渐变色
|
|
168
|
-
* @platform android
|
|
169
|
-
* @note iOS 不支持
|
|
170
|
-
*/
|
|
171
|
-
gradient?: boolean;
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* 是否绘制大地线
|
|
175
|
-
* @platform android
|
|
176
|
-
* @note iOS 不支持
|
|
177
|
-
*/
|
|
178
|
-
geodesic?: boolean;
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* 是否绘制虚线
|
|
182
|
-
* @platform android
|
|
183
|
-
* @note iOS 不支持
|
|
184
|
-
*/
|
|
185
|
-
dotted?: boolean;
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* 纹理图片
|
|
189
|
-
* 支持网络图片(http/https)、本地文件(file://)或资源名称
|
|
190
|
-
*/
|
|
191
|
-
texture?: string;
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* 点击事件
|
|
195
|
-
*/
|
|
196
|
-
onPolylinePress?: (event: NativeSyntheticEvent<{}>) => void;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* 多边形属性
|
|
201
|
-
*/
|
|
202
|
-
export interface PolygonProps {
|
|
203
|
-
/**
|
|
204
|
-
* 节点坐标数组
|
|
205
|
-
*/
|
|
206
|
-
points: LatLng[];
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
* 边线宽度
|
|
210
|
-
*/
|
|
211
|
-
strokeWidth?: number;
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* 边线颜色
|
|
215
|
-
*/
|
|
216
|
-
strokeColor?: ColorValue;
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* 填充颜色
|
|
220
|
-
*/
|
|
221
|
-
fillColor?: ColorValue;
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* 层级
|
|
225
|
-
*/
|
|
226
|
-
zIndex?: number;
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* 点击事件
|
|
230
|
-
*/
|
|
231
|
-
onPolygonPress?: (event: NativeSyntheticEvent<{}>) => void;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* 圆形属性
|
|
236
|
-
*/
|
|
237
|
-
export interface CircleProps {
|
|
238
|
-
/**
|
|
239
|
-
* 圆心坐标
|
|
240
|
-
*/
|
|
241
|
-
center: LatLng;
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* 半径(米)
|
|
245
|
-
*/
|
|
246
|
-
radius: number;
|
|
247
|
-
|
|
248
|
-
/**
|
|
249
|
-
* 边线宽度
|
|
250
|
-
*/
|
|
251
|
-
strokeWidth?: number;
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
* 边线颜色
|
|
255
|
-
*/
|
|
256
|
-
strokeColor?: ColorValue;
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* 填充颜色
|
|
260
|
-
*/
|
|
261
|
-
fillColor?: ColorValue;
|
|
262
|
-
|
|
263
|
-
/**
|
|
264
|
-
* 层级
|
|
265
|
-
*/
|
|
266
|
-
zIndex?: number;
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* 点击事件
|
|
270
|
-
*/
|
|
271
|
-
onCirclePress?: (event: NativeSyntheticEvent<{}>) => void;
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
/**
|
|
277
|
-
* 热力图属性
|
|
278
|
-
*/
|
|
279
|
-
export interface HeatMapProps {
|
|
280
|
-
/**
|
|
281
|
-
* 热力点数据
|
|
282
|
-
*/
|
|
283
|
-
data: LatLng[];
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* 热力半径(米)
|
|
287
|
-
*/
|
|
288
|
-
radius?: number;
|
|
289
|
-
|
|
290
|
-
/**
|
|
291
|
-
* 透明度 [0, 1]
|
|
292
|
-
*/
|
|
293
|
-
opacity?: number;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
/**
|
|
297
|
-
* 海量点标记项
|
|
298
|
-
*/
|
|
299
|
-
export interface MultiPointItem extends LatLng {
|
|
300
|
-
/**
|
|
301
|
-
* 唯一标识
|
|
302
|
-
*/
|
|
303
|
-
id?: string | number;
|
|
304
|
-
|
|
305
|
-
/**
|
|
306
|
-
* 自定义数据
|
|
307
|
-
*/
|
|
308
|
-
data?: any;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
/**
|
|
312
|
-
* 海量点属性
|
|
313
|
-
*/
|
|
314
|
-
export interface MultiPointProps {
|
|
315
|
-
/**
|
|
316
|
-
* 点集合
|
|
317
|
-
*/
|
|
318
|
-
items: MultiPointItem[];
|
|
319
|
-
|
|
320
|
-
/**
|
|
321
|
-
* 图标
|
|
322
|
-
*/
|
|
323
|
-
icon?: ImageSourcePropType;
|
|
324
|
-
|
|
325
|
-
/**
|
|
326
|
-
* 点击事件
|
|
327
|
-
*/
|
|
328
|
-
onPress?: (event: NativeSyntheticEvent<{ index: number; item: MultiPointItem }>) => void;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
/**
|
|
332
|
-
* 聚合点参数
|
|
333
|
-
*/
|
|
334
|
-
export interface ClusterParams {
|
|
335
|
-
/**
|
|
336
|
-
* 唯一标识
|
|
337
|
-
*/
|
|
338
|
-
id: number;
|
|
339
|
-
|
|
340
|
-
/**
|
|
341
|
-
* 包含的标记点数量
|
|
342
|
-
*/
|
|
343
|
-
count: number;
|
|
344
|
-
|
|
345
|
-
/**
|
|
346
|
-
* 聚合点坐标
|
|
347
|
-
*/
|
|
348
|
-
position: LatLng;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
/**
|
|
352
|
-
* 聚合点项
|
|
353
|
-
*/
|
|
354
|
-
export interface ClusterPoint {
|
|
355
|
-
/**
|
|
356
|
-
* 坐标
|
|
357
|
-
*/
|
|
358
|
-
position: LatLng;
|
|
359
|
-
|
|
360
|
-
/**
|
|
361
|
-
* 自定义数据
|
|
362
|
-
*/
|
|
363
|
-
properties?: any;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
/**
|
|
367
|
-
* 聚合图层属性
|
|
368
|
-
*/
|
|
369
|
-
export interface ClusterProps {
|
|
370
|
-
/**
|
|
371
|
-
* 聚合半径
|
|
372
|
-
*/
|
|
373
|
-
radius?: number;
|
|
374
|
-
|
|
375
|
-
/**
|
|
376
|
-
* 聚合点样式
|
|
377
|
-
*/
|
|
378
|
-
clusterStyle?: ViewStyle;
|
|
379
|
-
|
|
380
|
-
/**
|
|
381
|
-
* 聚合点文本样式
|
|
382
|
-
*/
|
|
383
|
-
clusterTextStyle?: ViewStyle;
|
|
384
|
-
|
|
385
|
-
/**
|
|
386
|
-
* 坐标点列表
|
|
387
|
-
*/
|
|
388
|
-
points: ClusterPoint[];
|
|
389
|
-
|
|
390
|
-
/**
|
|
391
|
-
* 渲染标记点
|
|
392
|
-
*/
|
|
393
|
-
renderMarker: (item: ClusterPoint) => React.ReactNode;
|
|
394
|
-
|
|
395
|
-
/**
|
|
396
|
-
* 渲染聚合点
|
|
397
|
-
*/
|
|
398
|
-
renderCluster?: (params: ClusterParams) => React.ReactNode;
|
|
399
|
-
|
|
400
|
-
/**
|
|
401
|
-
* 聚合点点击事件
|
|
402
|
-
*/
|
|
403
|
-
onPress?: (event: NativeSyntheticEvent<ClusterParams>) => void;
|
|
404
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 通用事件管理器
|
|
3
|
-
* 用于管理地图覆盖物的事件回调
|
|
4
|
-
*/
|
|
5
|
-
export class EventManager<T extends Record<string, any>> {
|
|
6
|
-
private callbacks = new Map<string, T>();
|
|
7
|
-
|
|
8
|
-
register(id: string, callbacks: T) {
|
|
9
|
-
this.callbacks.set(id, callbacks);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
unregister(id: string) {
|
|
13
|
-
this.callbacks.delete(id);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
trigger<K extends keyof T>(id: string, eventType: K, data?: any) {
|
|
17
|
-
const callbacks = this.callbacks.get(id);
|
|
18
|
-
const callback = callbacks?.[eventType];
|
|
19
|
-
if (typeof callback === 'function') {
|
|
20
|
-
callback(data);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 模块检测器 - 用于检测可选模块是否已安装
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 可选模块名称常量
|
|
7
|
-
*/
|
|
8
|
-
export const OptionalModules = {
|
|
9
|
-
SEARCH: 'expo-gaode-map-search',
|
|
10
|
-
NAVIGATION: 'expo-gaode-map-navigation',
|
|
11
|
-
ROUTE: 'expo-gaode-map-route',
|
|
12
|
-
GEOCODER: 'expo-gaode-map-geocoder',
|
|
13
|
-
} as const;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* 延迟加载可选模块
|
|
17
|
-
* 使用示例:
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```typescript
|
|
21
|
-
* import { OptionalModules, lazyLoad } from 'expo-gaode-map';
|
|
22
|
-
*
|
|
23
|
-
* let SearchModule = null;
|
|
24
|
-
*
|
|
25
|
-
* function loadSearch() {
|
|
26
|
-
* if (SearchModule == null) {
|
|
27
|
-
* try {
|
|
28
|
-
* SearchModule = require('expo-gaode-map-search');
|
|
29
|
-
* } catch (error) {
|
|
30
|
-
* console.warn('搜索模块未安装');
|
|
31
|
-
* return null;
|
|
32
|
-
* }
|
|
33
|
-
* }
|
|
34
|
-
* return SearchModule;
|
|
35
|
-
* }
|
|
36
|
-
*
|
|
37
|
-
* // 使用
|
|
38
|
-
* const search = loadSearch();
|
|
39
|
-
* if (search) {
|
|
40
|
-
* const results = await search.searchPOI({ keyword: '餐厅' });
|
|
41
|
-
* }
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* 检查必需模块,如果未安装则抛出错误
|
|
47
|
-
* @param moduleName 模块名称
|
|
48
|
-
* @param featureName 功能名称(用于错误提示)
|
|
49
|
-
*/
|
|
50
|
-
export function requireModule(moduleName: string, featureName: string): void {
|
|
51
|
-
console.warn(
|
|
52
|
-
`[expo-gaode-map] 使用 ${featureName} 需要安装 ${moduleName}。\n` +
|
|
53
|
-
`请运行: npm install ${moduleName}\n` +
|
|
54
|
-
`然后使用 try-catch 包裹 require('${moduleName}') 来加载`
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* 获取已安装的可选模块列表
|
|
60
|
-
* 注意: 此函数无法在运行时准确检测,仅作为文档说明
|
|
61
|
-
*/
|
|
62
|
-
export function getInstalledModules(): string[] {
|
|
63
|
-
console.warn(
|
|
64
|
-
'[expo-gaode-map] getInstalledModules() 无法在运行时检测。\n' +
|
|
65
|
-
'请在编译时检查 package.json 中安装的模块'
|
|
66
|
-
);
|
|
67
|
-
return [];
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* 打印已安装模块信息(用于调试)
|
|
72
|
-
*/
|
|
73
|
-
export function printModuleInfo(): void {
|
|
74
|
-
console.log('[expo-gaode-map] 核心模块: 已加载');
|
|
75
|
-
console.log('[expo-gaode-map] 可选模块检测:');
|
|
76
|
-
console.log(' - 使用 try-catch 包裹 require() 来检测可选模块');
|
|
77
|
-
console.log(' - 可用的可选模块:');
|
|
78
|
-
Object.entries(OptionalModules).forEach(([key, value]) => {
|
|
79
|
-
console.log(` - ${key}: ${value}`);
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* 创建延迟加载器
|
|
85
|
-
*
|
|
86
|
-
* @example
|
|
87
|
-
* ```typescript
|
|
88
|
-
* import { createLazyLoader } from 'expo-gaode-map';
|
|
89
|
-
*
|
|
90
|
-
* const loadSearch = createLazyLoader(() => require('expo-gaode-map-search'));
|
|
91
|
-
*
|
|
92
|
-
* // 使用时
|
|
93
|
-
* const SearchModule = loadSearch();
|
|
94
|
-
* if (SearchModule) {
|
|
95
|
-
* const results = await SearchModule.searchPOI({ keyword: '餐厅' });
|
|
96
|
-
* }
|
|
97
|
-
* ```
|
|
98
|
-
*/
|
|
99
|
-
export function createLazyLoader<T>(loader: () => T): () => T | null {
|
|
100
|
-
let cached: T | null = null;
|
|
101
|
-
let attempted = false;
|
|
102
|
-
|
|
103
|
-
return () => {
|
|
104
|
-
if (!attempted) {
|
|
105
|
-
attempted = true;
|
|
106
|
-
try {
|
|
107
|
-
cached = loader();
|
|
108
|
-
} catch (error) {
|
|
109
|
-
console.warn('[expo-gaode-map] 模块加载失败:', error);
|
|
110
|
-
cached = null;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
return cached;
|
|
114
|
-
};
|
|
115
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 导航模块坐标类型定义
|
|
3
|
-
* 简化版本,仅包含导航所需的基础坐标
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* 导航坐标点(简化版)
|
|
8
|
-
*/
|
|
9
|
-
export interface NaviPoint {
|
|
10
|
-
latitude: number;
|
|
11
|
-
longitude: number;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* 带名称的坐标点(POI)
|
|
16
|
-
*/
|
|
17
|
-
export interface NamedCoordinates extends NaviPoint {
|
|
18
|
-
/** 名称 */
|
|
19
|
-
name?: string;
|
|
20
|
-
/** POI ID */
|
|
21
|
-
poiId?: string;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// 为了向后兼容,导出 NaviPoint 作为 Coordinates 别名
|
|
25
|
-
export type Coordinates = NaviPoint;
|