expo-gaode-map-navigation 1.0.1-next.0 → 1.0.1-next.2

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 (40) hide show
  1. package/README.md +117 -28
  2. package/android/src/main/java/expo/modules/gaodemap/map/ExpoGaodeMapModule.kt +7 -0
  3. package/android/src/main/java/expo/modules/gaodemap/map/modules/SDKInitializer.kt +38 -3
  4. package/build/map/ExpoGaodeMapModule.js +5 -5
  5. package/ios/map/ExpoGaodeMapModule.swift +22 -6
  6. package/package.json +13 -6
  7. package/package.json.backup +0 -47
  8. package/plugin/README.md +0 -52
  9. package/plugin/build/withGaodeMap.d.ts +0 -22
  10. package/plugin/build/withGaodeMap.js +0 -169
  11. package/plugin/src/withGaodeMap.ts +0 -231
  12. package/plugin/tsconfig.tsbuildinfo +0 -1
  13. package/src/ExpoGaodeMapNaviView.tsx +0 -94
  14. package/src/ExpoGaodeMapNavigation.types.ts +0 -3
  15. package/src/ExpoGaodeMapNavigationModule.ts +0 -11
  16. package/src/index.ts +0 -262
  17. package/src/map/ExpoGaodeMap.types.ts +0 -46
  18. package/src/map/ExpoGaodeMapModule.ts +0 -315
  19. package/src/map/ExpoGaodeMapView.tsx +0 -120
  20. package/src/map/components/overlays/Circle.tsx +0 -20
  21. package/src/map/components/overlays/Cluster.tsx +0 -26
  22. package/src/map/components/overlays/HeatMap.tsx +0 -27
  23. package/src/map/components/overlays/Marker.tsx +0 -88
  24. package/src/map/components/overlays/MultiPoint.tsx +0 -27
  25. package/src/map/components/overlays/Polygon.tsx +0 -19
  26. package/src/map/components/overlays/Polyline.tsx +0 -19
  27. package/src/map/components/overlays/index.ts +0 -7
  28. package/src/map/index.ts +0 -37
  29. package/src/map/types/common.types.ts +0 -126
  30. package/src/map/types/index.ts +0 -55
  31. package/src/map/types/location.types.ts +0 -368
  32. package/src/map/types/map-view.types.ts +0 -281
  33. package/src/map/types/overlays.types.ts +0 -404
  34. package/src/map/utils/EventManager.ts +0 -23
  35. package/src/map/utils/ModuleLoader.ts +0 -115
  36. package/src/types/coordinates.types.ts +0 -25
  37. package/src/types/independent.types.ts +0 -288
  38. package/src/types/index.ts +0 -5
  39. package/src/types/naviview.types.ts +0 -330
  40. package/src/types/route.types.ts +0 -305
@@ -1,315 +0,0 @@
1
- /**
2
- * 高德地图原生模块
3
- * 提供 SDK 初始化、定位、权限管理等功能
4
- */
5
-
6
- import { NativeModule, requireNativeModule } from 'expo';
7
- import type { ExpoGaodeMapModuleEvents } from './ExpoGaodeMap.types';
8
- import type {
9
- LatLng,
10
- CoordinateType,
11
- Coordinates,
12
- ReGeocode,
13
- LocationMode,
14
- LocationAccuracy,
15
- LocationListener,
16
- } from './types';
17
-
18
- /**
19
- * SDK 配置参数
20
- */
21
- export interface SDKConfig {
22
- /** Android 平台的高德地图 API Key */
23
- androidKey?: string;
24
- /** iOS 平台的高德地图 API Key */
25
- iosKey?: string;
26
- /** web api key:若要使用 web-api 相关功能,建议在初始化时提供 */
27
- webKey?: string;
28
- }
29
-
30
- /**
31
- * 权限状态
32
- */
33
- export interface PermissionStatus {
34
- /** 是否已授权 */
35
- granted: boolean;
36
- /** iOS 权限状态字符串 */
37
- status?: 'notDetermined' | 'restricted' | 'denied' | 'authorizedAlways' | 'authorizedWhenInUse' | 'unknown';
38
- /** Android 精确位置权限 */
39
- fineLocation?: boolean;
40
- /** Android 粗略位置权限 */
41
- coarseLocation?: boolean;
42
- }
43
-
44
- /**
45
- * 高德地图原生模块类声明
46
- */
47
- declare class ExpoGaodeMapModule extends NativeModule<ExpoGaodeMapModuleEvents> {
48
- // ==================== 隐私合规管理 ====================
49
-
50
- /**
51
- * 更新隐私合规状态
52
- * 必须在用户同意隐私协议后调用
53
- * @param hasAgreed 用户是否已同意隐私协议
54
- */
55
- updatePrivacyCompliance(hasAgreed: boolean): void;
56
-
57
- // ==================== SDK 初始化 ====================
58
-
59
- /**
60
- * 初始化高德地图 SDK
61
- * @param config SDK 配置参数,包含 Android 和 iOS 的 API Key
62
- */
63
- initSDK(config: SDKConfig): void;
64
-
65
- /**
66
- * 获取高德地图 SDK 版本号
67
- * @returns SDK 版本字符串
68
- */
69
- getVersion(): string;
70
-
71
- // ==================== 定位控制 ====================
72
-
73
- /**
74
- * 开始连续定位
75
- * 启动后会持续接收位置更新,通过 onLocationUpdate 事件回调
76
- */
77
- start(): void;
78
-
79
- /**
80
- * 停止定位
81
- * 停止接收位置更新
82
- */
83
- stop(): void;
84
-
85
- /**
86
- * 检查是否正在定位
87
- * @returns Promise<boolean> 是否正在定位
88
- */
89
- isStarted(): Promise<boolean>;
90
-
91
- /**
92
- * 获取当前位置(单次定位)
93
- * @returns Promise<Coordinates | ReGeocode> 位置信息,包含坐标和可选的逆地理编码信息
94
- */
95
- getCurrentLocation(): Promise<Coordinates | ReGeocode>;
96
-
97
- /**
98
- * 坐标转换
99
- * 将其他坐标系的坐标转换为高德地图使用的 GCJ-02 坐标系
100
- * @param coordinate 需要转换的坐标
101
- * @param type 原坐标系类型
102
- * @returns Promise<LatLng> 转换后的 GCJ-02 坐标
103
- */
104
- coordinateConvert(coordinate: LatLng, type: CoordinateType): Promise<LatLng>;
105
-
106
- // ==================== 定位配置 ====================
107
-
108
- /**
109
- * 设置是否返回逆地理编码信息
110
- * @param isReGeocode true: 返回地址信息; false: 只返回坐标
111
- */
112
- setLocatingWithReGeocode(isReGeocode: boolean): void;
113
-
114
- /**
115
- * 设置定位模式(Android)
116
- * @param mode 定位模式:0-低功耗, 1-仅设备, 2-高精度
117
- */
118
- setLocationMode(mode: LocationMode): void;
119
-
120
- /**
121
- * 设置定位间隔(毫秒)
122
- * @param interval 定位间隔时间,单位毫秒,默认 2000ms
123
- */
124
- setInterval(interval: number): void;
125
-
126
- /**
127
- * 设置是否单次定位(Android)
128
- * @param isOnceLocation true: 单次定位; false: 连续定位
129
- */
130
- setOnceLocation(isOnceLocation: boolean): void;
131
-
132
- /**
133
- * 设置是否使用设备传感器(Android)
134
- * @param sensorEnable true: 使用传感器; false: 不使用
135
- */
136
- setSensorEnable(sensorEnable: boolean): void;
137
-
138
- /**
139
- * 设置是否允许 WiFi 扫描(Android)
140
- * @param wifiScan true: 允许; false: 不允许
141
- */
142
- setWifiScan(wifiScan: boolean): void;
143
-
144
- /**
145
- * 设置是否 GPS 优先(Android)
146
- * @param gpsFirst true: GPS 优先; false: 网络优先
147
- */
148
- setGpsFirst(gpsFirst: boolean): void;
149
-
150
- /**
151
- * 设置是否等待 WiFi 列表刷新(Android)
152
- * @param onceLocationLatest true: 等待; false: 不等待
153
- */
154
- setOnceLocationLatest(onceLocationLatest: boolean): void;
155
-
156
- /**
157
- * 设置逆地理编码语言
158
- * @param language 语言代码,如 "zh-CN", "en"
159
- */
160
- setGeoLanguage(language: string): void;
161
-
162
- /**
163
- * 设置是否使用缓存策略(Android)
164
- * @param locationCacheEnable true: 使用缓存; false: 不使用
165
- */
166
- setLocationCacheEnable(locationCacheEnable: boolean): void;
167
-
168
- /**
169
- * 设置网络请求超时时间(Android)
170
- * @param httpTimeOut 超时时间,单位毫秒
171
- */
172
- setHttpTimeOut(httpTimeOut: number): void;
173
-
174
- /**
175
- * 设置期望的定位精度(iOS)
176
- * @param accuracy 精度级别:0-最佳, 1-10米, 2-100米, 3-1公里, 4-3公里
177
- */
178
- setDesiredAccuracy(accuracy: LocationAccuracy): void;
179
-
180
- /**
181
- * 设置定位超时时间(秒)
182
- * @param timeout 超时时间,单位秒,默认 10 秒
183
- */
184
- setLocationTimeout(timeout: number): void;
185
-
186
- /**
187
- * 设置逆地理编码超时时间(秒)
188
- * @param timeout 超时时间,单位秒,默认 5 秒
189
- */
190
- setReGeocodeTimeout(timeout: number): void;
191
-
192
- /**
193
- * 设置距离过滤器(米)(iOS)
194
- * 只有移动超过指定距离才会更新位置
195
- * @param distance 距离阈值,单位米
196
- */
197
- setDistanceFilter(distance: number): void;
198
-
199
- /**
200
- * 设置是否自动暂停位置更新(iOS)
201
- * @param pauses true: 自动暂停; false: 不暂停
202
- */
203
- setPausesLocationUpdatesAutomatically(pauses: boolean): void;
204
-
205
- /**
206
- * 设置是否允许后台定位(iOS)
207
- * @param allows true: 允许; false: 不允许
208
- */
209
- setAllowsBackgroundLocationUpdates(allows: boolean): void;
210
-
211
- /**
212
- * 设置定位协议
213
- * @param protocol 协议类型
214
- */
215
- setLocationProtocol(protocol: string): void;
216
-
217
- // ==================== 方向更新 (iOS) ====================
218
-
219
- /**
220
- * 开始更新设备方向(罗盘朝向)
221
- * 通过 onHeadingUpdate 事件接收方向更新
222
- * @platform ios
223
- */
224
- startUpdatingHeading(): void;
225
-
226
- /**
227
- * 停止更新设备方向
228
- * @platform ios
229
- */
230
- stopUpdatingHeading(): void;
231
-
232
- // ==================== 权限管理 ====================
233
-
234
- /**
235
- * 检查位置权限状态
236
- * @returns Promise<PermissionStatus> 权限状态
237
- */
238
- checkLocationPermission(): Promise<PermissionStatus>;
239
-
240
- /**
241
- * 请求位置权限
242
- * @returns Promise<PermissionStatus> 请求后的权限状态
243
- */
244
- requestLocationPermission(): Promise<PermissionStatus>;
245
-
246
- // ==================== 便捷方法 ====================
247
-
248
- /**
249
- * 添加定位监听器(便捷方法)
250
- * 封装了 addListener,提供更简洁的 API
251
- * @param listener 定位回调函数
252
- * @returns 订阅对象,调用 remove() 取消监听
253
- */
254
- addLocationListener(listener: LocationListener): { remove: () => void };
255
- }
256
-
257
- // 获取原生模块实例 - 添加容错处理
258
- let nativeModule: ExpoGaodeMapModule | null = null;
259
-
260
- try {
261
- nativeModule = requireNativeModule<ExpoGaodeMapModule>('NaviMap');
262
- } catch (error) {
263
- console.warn('NaviMap 原生模块加载失败:', error);
264
- }
265
-
266
- // 如果模块加载失败,创建一个空的代理对象防止崩溃
267
- if (!nativeModule) {
268
- console.error('NaviMap: 原生模块不可用,请检查配置');
269
- }
270
-
271
- // 记录最近一次 initSDK 的配置(含 webKey)
272
- let _sdkConfig: SDKConfig | null = null;
273
-
274
- // 扩展原生模块,添加便捷方法
275
- const ExpoGaodeMapModuleWithHelpers = {
276
- ...(nativeModule || {}),
277
-
278
- /**
279
- * 初始化 SDK,并缓存配置(包含 webKey)
280
- */
281
- initSDK(config: SDKConfig): void {
282
- _sdkConfig = config ?? null;
283
- nativeModule?.initSDK?.(config);
284
- },
285
-
286
- /**
287
- * 添加定位监听器(便捷方法)
288
- * 自动订阅 onLocationUpdate 事件,提供容错处理
289
- * @param listener 定位回调函数
290
- * @returns 订阅对象,调用 remove() 取消监听
291
- * @throws 如果底层模块不可用,返回一个空操作的订阅对象
292
- */
293
- addLocationListener(listener: LocationListener): { remove: () => void } {
294
- // 使用可选链和空值合并,确保即使模块不可用也不会崩溃
295
- return nativeModule?.addListener?.('onLocationUpdate', listener) || {
296
- remove: () => {},
297
- };
298
- },
299
- };
300
-
301
- /**
302
- * 获取最近一次 initSDK 的配置
303
- */
304
- export function getSDKConfig(): SDKConfig | null {
305
- return _sdkConfig;
306
- }
307
-
308
- /**
309
- * 获取用于 Web API 的 webKey(若未初始化或未提供则返回 undefined)
310
- */
311
- export function getWebKey(): string | undefined {
312
- return _sdkConfig?.webKey;
313
- }
314
-
315
- export default ExpoGaodeMapModuleWithHelpers as ExpoGaodeMapModule;
@@ -1,120 +0,0 @@
1
- import { requireNativeViewManager } from 'expo-modules-core';
2
- import * as React from 'react';
3
-
4
- import type {
5
- MapViewProps,
6
- MapViewRef,
7
- CameraPosition,
8
- LatLng,
9
- Point,
10
-
11
- } from './types';
12
-
13
- export type { MapViewRef } from './types';
14
-
15
- const NativeView: React.ComponentType<MapViewProps & { ref?: React.Ref<MapViewRef> }> = requireNativeViewManager('NaviMapView');
16
-
17
-
18
- /**
19
- * 高德地图视图组件,提供地图操作API和覆盖物管理功能
20
- *
21
- * @param props - 组件属性
22
- * @param ref - 外部ref引用,用于访问地图API方法
23
- * @returns 返回包含地图视图和上下文提供者的React组件
24
- *
25
- * @remarks
26
- * 该组件内部维护两个ref:
27
- * - nativeRef: 指向原生地图视图的引用
28
- * - internalRef: 内部使用的API引用,通过MapContext共享
29
- *
30
- * 提供的主要API功能包括:
31
- * - 相机控制(移动、缩放、获取当前位置)
32
- * - 覆盖物管理(添加/删除/更新标记、折线、多边形、圆形等)
33
- *
34
- * 所有API方法都会检查地图是否已初始化,未初始化时抛出错误
35
- */
36
- const ExpoGaodeMapView = React.forwardRef<MapViewRef, MapViewProps>((props, ref) => {
37
- const nativeRef = React.useRef<MapViewRef>(null);
38
- const internalRef = React.useRef<MapViewRef | null>(null);
39
-
40
-
41
- const apiRef: MapViewRef = React.useMemo(() => ({
42
- /**
43
- * 移动地图相机到指定位置
44
- * @param position 相机位置参数对象,包含目标经纬度、缩放级别等信息
45
- * @param duration 动画持续时间(毫秒),默认300毫秒
46
- * @throws 如果地图视图未初始化则抛出错误
47
- * @returns Promise<void> 异步操作完成后的Promise
48
- */
49
- moveCamera: async (position: CameraPosition, duration: number = 300) => {
50
- if (!nativeRef.current) throw new Error('MapView not initialized');
51
- return nativeRef.current.moveCamera(position, duration);
52
- },
53
- /**
54
- * 将屏幕坐标点转换为地理坐标(经纬度)
55
- * @param point 屏幕坐标点 {x: number, y: number}
56
- * @returns 返回Promise,解析为对应的地理坐标 {latitude: number, longitude: number}
57
- * @throws 如果地图视图未初始化,抛出错误 'MapView not initialized'
58
- */
59
- getLatLng: async (point: Point) => {
60
- if (!nativeRef.current) throw new Error('MapView not initialized');
61
- return nativeRef.current.getLatLng(point);
62
- },
63
- /**
64
- * 设置地图中心点坐标
65
- * @param center 要设置的中心点坐标(LatLng格式)
66
- * @param animated 是否使用动画效果移动地图(默认为false)
67
- * @throws 如果地图视图未初始化则抛出错误
68
- */
69
- setCenter: async (center: LatLng, animated: boolean = false) => {
70
- if (!nativeRef.current) throw new Error('MapView not initialized');
71
- return nativeRef.current.setCenter(center, animated);
72
- },
73
- /**
74
- * 设置地图的缩放级别
75
- * @param zoom 目标缩放级别
76
- * @param animated 是否使用动画过渡效果,默认为false
77
- * @throws 如果地图视图未初始化,抛出错误
78
- */
79
- setZoom: async (zoom: number, animated: boolean = false) => {
80
- if (!nativeRef.current) throw new Error('MapView not initialized');
81
- return nativeRef.current.setZoom(zoom, animated);
82
- },
83
- /**
84
- * 获取当前地图的相机位置(视角中心点、缩放级别、倾斜角度等)
85
- * @returns 返回一个Promise,解析为当前相机位置的对象
86
- * @throws 如果地图视图未初始化,则抛出错误
87
- */
88
- getCameraPosition: async () => {
89
- if (!nativeRef.current) throw new Error('MapView not initialized');
90
- return nativeRef.current.getCameraPosition();
91
- }
92
-
93
- }), []);
94
-
95
- /**
96
- * 将传入的apiRef赋值给internalRef.current
97
- * 用于在组件内部保存对地图API实例的引用
98
- */
99
- React.useEffect(() => {
100
- internalRef.current = apiRef;
101
- }, [apiRef]);
102
-
103
- /**
104
- * 获取当前地图实例的API引用
105
- * @returns 返回地图API的引用对象,可用于调用地图相关方法
106
- */
107
- React.useImperativeHandle(ref, () => apiRef, [apiRef]);
108
-
109
- return (
110
- <NativeView
111
- ref={nativeRef}
112
- {...props}>
113
- {props.children}
114
- </NativeView>
115
- );
116
- });
117
-
118
- ExpoGaodeMapView.displayName = 'ExpoGaodeMapView';
119
-
120
- export default ExpoGaodeMapView;
@@ -1,20 +0,0 @@
1
-
2
- import * as React from 'react';
3
- import { requireNativeViewManager } from 'expo-modules-core';
4
- import type { CircleProps } from '../../types';
5
-
6
- const NativeCircleView = requireNativeViewManager<CircleProps>('NaviCircleView');
7
-
8
- /**
9
- * 高德地图圆形覆盖物组件(声明式)
10
- *
11
- *
12
- * @param props 圆形组件的属性配置
13
- * @returns 渲染原生圆形组件
14
- */
15
- function Circle(props: CircleProps) {
16
- return <NativeCircleView {...props} />;
17
- }
18
-
19
- // 导出优化后的组件
20
- export default React.memo(Circle);
@@ -1,26 +0,0 @@
1
- /*
2
- * @Author : 尚博信_王强 wangqiang03@sunboxsoft.com
3
- * @Date : 2025-12-03 14:27:06
4
- * @LastEditors : 尚博信_王强 wangqiang03@sunboxsoft.com
5
- * @LastEditTime : 2025-12-05 16:21:29
6
- * @FilePath : /expo-gaode-map/packages/navigation/src/map/components/overlays/Cluster.tsx
7
- * @Description :
8
- *
9
- * Copyright (c) 2025 by 尚博信_王强, All Rights Reserved.
10
- */
11
-
12
- import { requireNativeViewManager } from 'expo-modules-core';
13
- import * as React from 'react';
14
- import type { ClusterProps } from '../../types';
15
-
16
- const NativeCluster = requireNativeViewManager('NaviClusterView');
17
-
18
- /**
19
- * 高德地图点聚合组件
20
- *
21
- * @param props 点聚合组件的属性配置
22
- * @returns 渲染原生点聚合组件
23
- */
24
- export default function Cluster(props: ClusterProps) {
25
- return <NativeCluster {...props} />;
26
- }
@@ -1,27 +0,0 @@
1
- /*
2
- * @Author : 尚博信_王强 wangqiang03@sunboxsoft.com
3
- * @Date : 2025-12-03 14:27:06
4
- * @LastEditors : 尚博信_王强 wangqiang03@sunboxsoft.com
5
- * @LastEditTime : 2025-12-05 16:21:04
6
- * @FilePath : /expo-gaode-map/packages/navigation/src/map/components/overlays/HeatMap.tsx
7
- * @Description :
8
- *
9
- * Copyright (c) 2025 by 尚博信_王强, All Rights Reserved.
10
- */
11
-
12
- import { requireNativeViewManager } from 'expo-modules-core';
13
- import * as React from 'react';
14
- import type { HeatMapProps } from '../../types';
15
-
16
- const NativeHeatMap = requireNativeViewManager('NaviHeatMapView');
17
-
18
-
19
- /**
20
- * 高德地图热力图组件
21
- *
22
- * @param props - 热力图配置属性,继承自NativeHeatMap组件的属性
23
- * @returns 渲染高德地图原生热力图组件
24
- */
25
- export default function HeatMap(props: HeatMapProps) {
26
- return <NativeHeatMap {...props} />;
27
- }
@@ -1,88 +0,0 @@
1
-
2
-
3
- import * as React from 'react';
4
- import { requireNativeViewManager } from 'expo-modules-core';
5
- import type { MarkerProps } from '../../types';
6
-
7
- const NativeMarkerView = requireNativeViewManager('NaviMarkerView');
8
-
9
- /**
10
- * Marker 组件 - 完全声明式 API
11
- *
12
- * 支持:
13
- * - 自定义图标(icon)
14
- * - 自定义内容(children)
15
- * - 大头针样式(pinColor)
16
- * - 拖拽功能
17
- * - 所有事件回调
18
- */
19
- function Marker(props: MarkerProps) {
20
- // 根据是否有 children 来决定使用哪个尺寸属性
21
- // 有 children:使用 customViewWidth/customViewHeight(默认 200x40)
22
- // 无 children:使用 iconWidth/iconHeight(用于自定义图标,默认 40x40)
23
- const containerWidth = props.children
24
- ? (props.customViewWidth && props.customViewWidth > 0 ? props.customViewWidth : 200)
25
- : (props.iconWidth && props.iconWidth > 0 ? props.iconWidth : 40);
26
- const containerHeight = props.children
27
- ? (props.customViewHeight && props.customViewHeight > 0 ? props.customViewHeight : 40)
28
- : (props.iconHeight && props.iconHeight > 0 ? props.iconHeight : 40);
29
-
30
- // 从 props 中排除 position 属性,避免传递到原生层
31
- const { position, ...restProps } = props;
32
-
33
- return (
34
- <NativeMarkerView
35
- latitude={position.latitude}
36
- longitude={position.longitude}
37
- iconWidth={containerWidth}
38
- iconHeight={containerHeight}
39
- customViewWidth={containerWidth}
40
- customViewHeight={containerHeight}
41
- {...restProps}
42
- >
43
- {props.children}
44
- </NativeMarkerView>
45
- );
46
- }
47
-
48
- /**
49
- * 自定义比较函数
50
- * 深度比较 position 和其他关键属性
51
- */
52
- function arePropsEqual(prevProps: MarkerProps, nextProps: MarkerProps): boolean {
53
- // 比较 position
54
- if (
55
- prevProps.position.latitude !== nextProps.position.latitude ||
56
- prevProps.position.longitude !== nextProps.position.longitude
57
- ) {
58
- return false;
59
- }
60
-
61
- // 比较基础属性
62
- if (
63
- prevProps.title !== nextProps.title ||
64
- prevProps.snippet !== nextProps.snippet ||
65
- prevProps.icon !== nextProps.icon ||
66
- prevProps.pinColor !== nextProps.pinColor ||
67
- prevProps.draggable !== nextProps.draggable ||
68
- prevProps.animatesDrop !== nextProps.animatesDrop ||
69
- prevProps.iconWidth !== nextProps.iconWidth ||
70
- prevProps.iconHeight !== nextProps.iconHeight ||
71
- prevProps.customViewWidth !== nextProps.customViewWidth ||
72
- prevProps.customViewHeight !== nextProps.customViewHeight
73
- ) {
74
- return false;
75
- }
76
-
77
- // 比较 children(简单比较,可根据需要深度比较)
78
- if (prevProps.children !== nextProps.children) {
79
- return false;
80
- }
81
-
82
- // 其他属性相同,不需要重新渲染
83
- return true;
84
- }
85
-
86
- // 导出优化后的组件
87
- export default React.memo(Marker, arePropsEqual);
88
-
@@ -1,27 +0,0 @@
1
- /*
2
- * @Author : 尚博信_王强 wangqiang03@sunboxsoft.com
3
- * @Date : 2025-12-03 14:27:06
4
- * @LastEditors : 尚博信_王强 wangqiang03@sunboxsoft.com
5
- * @LastEditTime : 2025-12-05 16:21:15
6
- * @FilePath : /expo-gaode-map/packages/navigation/src/map/components/overlays/MultiPoint.tsx
7
- * @Description :
8
- *
9
- * Copyright (c) 2025 by 尚博信_王强, All Rights Reserved.
10
- */
11
-
12
- import { requireNativeViewManager } from 'expo-modules-core';
13
- import * as React from 'react';
14
- import type { MultiPointProps } from '../../types';
15
-
16
- const NativeMultiPoint = requireNativeViewManager('NaviMultiPointView');
17
-
18
-
19
- /**
20
- * 高德地图多点标记组件
21
- *
22
- * @param props 多点标记的配置属性,继承自MultiPointProps接口
23
- * @returns 渲染原生高德地图多点标记组件
24
- */
25
- export default function MultiPoint(props: MultiPointProps) {
26
- return <NativeMultiPoint {...props} />;
27
- }
@@ -1,19 +0,0 @@
1
-
2
- import * as React from 'react';
3
- import type { PolygonProps } from '../../types';
4
-
5
- import { requireNativeViewManager } from 'expo-modules-core';
6
- const NativePolygonView = requireNativeViewManager<PolygonProps>('NaviPolygonView');
7
-
8
- /**
9
- * 渲染一个高德地图多边形覆盖物组件
10
- *
11
- * @param props - 多边形属性配置,继承自PolygonProps类型
12
- * @returns 高德地图原生多边形视图组件
13
- */
14
- function Polygon(props: PolygonProps) {
15
- return <NativePolygonView {...props} />;
16
- }
17
-
18
- // 导出优化后的组件
19
- export default React.memo(Polygon);
@@ -1,19 +0,0 @@
1
-
2
- import * as React from 'react';
3
- import type { PolylineProps } from '../../types';
4
-
5
- import { requireNativeViewManager } from 'expo-modules-core';
6
- const NativePolylineView = requireNativeViewManager<PolylineProps>('NaviPolylineView');
7
-
8
- /**
9
- * 渲染高德地图上的折线覆盖物组件
10
- *
11
- * @param props - 折线属性配置,继承自PolylineProps类型
12
- * @returns 高德地图原生折线视图组件
13
- */
14
- function Polyline(props: PolylineProps) {
15
- return <NativePolylineView {...props} />;
16
- }
17
-
18
- // 导出优化后的组件
19
- export default React.memo(Polyline);
@@ -1,7 +0,0 @@
1
- export { default as Marker } from './Marker';
2
- export { default as Polyline } from './Polyline';
3
- export { default as Polygon } from './Polygon';
4
- export { default as Circle } from './Circle';
5
- export { default as HeatMap } from './HeatMap';
6
- export { default as MultiPoint } from './MultiPoint';
7
- export { default as Cluster } from './Cluster';