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,63 @@
1
+ /*
2
+ * @Author : 尚博信_王强 wangqiang03@sunboxsoft.com
3
+ * @Date : 2025-11-13 15:02:00
4
+ * @LastEditors : 尚博信_王强 wangqiang03@sunboxsoft.com
5
+ * @LastEditTime : 2025-11-13 18:43:00
6
+ * @FilePath : /expo-gaode-map/src/components/overlays/Circle.tsx
7
+ * @Description : 地图圆形组件 - 使用命令式 API
8
+ *
9
+ * Copyright (c) 2025 by 尚博信_王强, All Rights Reserved.
10
+ */
11
+ import * as React from 'react';
12
+ import { MapContext } from '../../ExpoGaodeMapView';
13
+ /**
14
+ * 地图圆形组件
15
+ *
16
+ * @example
17
+ * ```tsx
18
+ * <MapView>
19
+ * <Circle
20
+ * center={{ latitude: 39.9, longitude: 116.4 }}
21
+ * radius={1000}
22
+ * fillColor={0x440000FF}
23
+ * strokeColor={0xFFFF0000}
24
+ * />
25
+ * </MapView>
26
+ * ```
27
+ */
28
+ export default function Circle(props) {
29
+ const mapRef = React.useContext(MapContext);
30
+ const circleIdRef = React.useRef(null);
31
+ console.log('Circle 组件渲染,props:', JSON.stringify(props));
32
+ React.useEffect(() => {
33
+ console.log('Circle useEffect - 添加圆形到地图');
34
+ if (!mapRef?.current) {
35
+ console.warn('MapRef 不可用');
36
+ return;
37
+ }
38
+ // 添加圆形
39
+ const circleId = `circle_${Date.now()}_${Math.random()}`;
40
+ circleIdRef.current = circleId;
41
+ mapRef.current.addCircle(circleId, props);
42
+ console.log('✅ 圆形已添加:', circleId);
43
+ // 清理函数 - 移除圆形
44
+ return () => {
45
+ console.log('Circle useEffect cleanup - 移除圆形');
46
+ if (circleIdRef.current && mapRef?.current) {
47
+ mapRef.current.removeCircle(circleIdRef.current);
48
+ console.log('✅ 圆形已移除:', circleIdRef.current);
49
+ }
50
+ };
51
+ }, []);
52
+ // 当 props 变化时更新圆形
53
+ React.useEffect(() => {
54
+ console.log('Circle props 变化,更新圆形');
55
+ if (circleIdRef.current && mapRef?.current) {
56
+ mapRef.current.updateCircle(circleIdRef.current, props);
57
+ console.log('✅ 圆形已更新:', circleIdRef.current);
58
+ }
59
+ }, [props.center, props.radius, props.fillColor, props.strokeColor, props.strokeWidth]);
60
+ // 不渲染任何 UI
61
+ return null;
62
+ }
63
+ //# sourceMappingURL=Circle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Circle.js","sourceRoot":"","sources":["../../../src/components/overlays/Circle.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAkB;IAC/C,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IA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,YAAY,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;YACxD,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC;IAExF,WAAW;IACX,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["/*\n * @Author : 尚博信_王强 wangqiang03@sunboxsoft.com\n * @Date : 2025-11-13 15:02:00\n * @LastEditors : 尚博信_王强 wangqiang03@sunboxsoft.com\n * @LastEditTime : 2025-11-13 18:43:00\n * @FilePath : /expo-gaode-map/src/components/overlays/Circle.tsx\n * @Description : 地图圆形组件 - 使用命令式 API\n * \n * Copyright (c) 2025 by 尚博信_王强, All Rights Reserved. \n */\n\nimport * as React from 'react';\nimport type { CircleProps } from '../../types';\nimport { MapContext } from '../../ExpoGaodeMapView';\n\n/**\n * 地图圆形组件\n * \n * @example\n * ```tsx\n * <MapView>\n * <Circle\n * center={{ latitude: 39.9, longitude: 116.4 }}\n * radius={1000}\n * fillColor={0x440000FF}\n * strokeColor={0xFFFF0000}\n * />\n * </MapView>\n * ```\n */\nexport default function Circle(props: CircleProps) {\n const mapRef = React.useContext(MapContext);\n const circleIdRef = React.useRef<string | null>(null);\n \n console.log('Circle 组件渲染,props:', JSON.stringify(props));\n \n React.useEffect(() => {\n console.log('Circle useEffect - 添加圆形到地图');\n \n if (!mapRef?.current) {\n console.warn('MapRef 不可用');\n return;\n }\n \n // 添加圆形\n const circleId = `circle_${Date.now()}_${Math.random()}`;\n circleIdRef.current = circleId;\n \n mapRef.current.addCircle(circleId, props);\n console.log('✅ 圆形已添加:', circleId);\n \n // 清理函数 - 移除圆形\n return () => {\n console.log('Circle useEffect cleanup - 移除圆形');\n if (circleIdRef.current && mapRef?.current) {\n mapRef.current.removeCircle(circleIdRef.current);\n console.log('✅ 圆形已移除:', circleIdRef.current);\n }\n };\n }, []);\n \n // 当 props 变化时更新圆形\n React.useEffect(() => {\n console.log('Circle props 变化,更新圆形');\n if (circleIdRef.current && mapRef?.current) {\n mapRef.current.updateCircle(circleIdRef.current, props);\n console.log('✅ 圆形已更新:', circleIdRef.current);\n }\n }, [props.center, props.radius, props.fillColor, props.strokeColor, props.strokeWidth]);\n \n // 不渲染任何 UI\n return null;\n}\n"]}
@@ -0,0 +1,22 @@
1
+ import * as React from 'react';
2
+ import type { ClusterProps } from '../../types';
3
+ /**
4
+ * 地图点聚合组件
5
+ * 将相近的标记点聚合显示,提高大量标记的展示性能
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * <MapView>
10
+ * <Cluster
11
+ * points={[
12
+ * { latitude: 39.9, longitude: 116.4, id: '1' },
13
+ * { latitude: 39.91, longitude: 116.41, id: '2' },
14
+ * ]}
15
+ * radius={60}
16
+ * minClusterSize={2}
17
+ * />
18
+ * </MapView>
19
+ * ```
20
+ */
21
+ export default function Cluster(props: ClusterProps): React.JSX.Element;
22
+ //# sourceMappingURL=Cluster.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Cluster.d.ts","sourceRoot":"","sources":["../../../src/components/overlays/Cluster.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAIhD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,KAAK,EAAE,YAAY,qBAElD"}
@@ -0,0 +1,35 @@
1
+ /*
2
+ * @Author : 尚博信_王强 wangqiang03@sunboxsoft.com
3
+ * @Date : 2025-11-13 15:02:50
4
+ * @LastEditors : 尚博信_王强 wangqiang03@sunboxsoft.com
5
+ * @LastEditTime : 2025-11-13 18:19:20
6
+ * @FilePath : /expo-gaode-map/src/components/overlays/Cluster.tsx
7
+ * @Description : 地图点聚合组件
8
+ *
9
+ * Copyright (c) 2025 by 尚博信_王强, All Rights Reserved.
10
+ */
11
+ import { requireNativeViewManager } from 'expo-modules-core';
12
+ import * as React from 'react';
13
+ const NativeCluster = requireNativeViewManager('ExpoGaodeMap_ClusterView');
14
+ /**
15
+ * 地图点聚合组件
16
+ * 将相近的标记点聚合显示,提高大量标记的展示性能
17
+ *
18
+ * @example
19
+ * ```tsx
20
+ * <MapView>
21
+ * <Cluster
22
+ * points={[
23
+ * { latitude: 39.9, longitude: 116.4, id: '1' },
24
+ * { latitude: 39.91, longitude: 116.41, id: '2' },
25
+ * ]}
26
+ * radius={60}
27
+ * minClusterSize={2}
28
+ * />
29
+ * </MapView>
30
+ * ```
31
+ */
32
+ export default function Cluster(props) {
33
+ return <NativeCluster {...props}/>;
34
+ }
35
+ //# sourceMappingURL=Cluster.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Cluster.js","sourceRoot":"","sources":["../../../src/components/overlays/Cluster.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,aAAa,GAAG,wBAAwB,CAAC,0BAA0B,CAAC,CAAC;AAE3E;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,KAAmB;IACjD,OAAO,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AACtC,CAAC","sourcesContent":["/*\n * @Author : 尚博信_王强 wangqiang03@sunboxsoft.com\n * @Date : 2025-11-13 15:02:50\n * @LastEditors : 尚博信_王强 wangqiang03@sunboxsoft.com\n * @LastEditTime : 2025-11-13 18:19:20\n * @FilePath : /expo-gaode-map/src/components/overlays/Cluster.tsx\n * @Description : 地图点聚合组件\n * \n * Copyright (c) 2025 by 尚博信_王强, All Rights Reserved. \n */\n\nimport { requireNativeViewManager } from 'expo-modules-core';\nimport * as React from 'react';\nimport type { ClusterProps } from '../../types';\n\nconst NativeCluster = requireNativeViewManager('ExpoGaodeMap_ClusterView');\n\n/**\n * 地图点聚合组件\n * 将相近的标记点聚合显示,提高大量标记的展示性能\n * \n * @example\n * ```tsx\n * <MapView>\n * <Cluster\n * points={[\n * { latitude: 39.9, longitude: 116.4, id: '1' },\n * { latitude: 39.91, longitude: 116.41, id: '2' },\n * ]}\n * radius={60}\n * minClusterSize={2}\n * />\n * </MapView>\n * ```\n */\nexport default function Cluster(props: ClusterProps) {\n return <NativeCluster {...props} />;\n}\n"]}
@@ -0,0 +1,21 @@
1
+ import * as React from 'react';
2
+ import type { HeatMapProps } from '../../types';
3
+ /**
4
+ * 地图热力图组件
5
+ *
6
+ * @example
7
+ * ```tsx
8
+ * <MapView>
9
+ * <HeatMap
10
+ * data={[
11
+ * { latitude: 39.9, longitude: 116.4, intensity: 100 },
12
+ * { latitude: 39.91, longitude: 116.41, intensity: 80 },
13
+ * ]}
14
+ * radius={50}
15
+ * opacity={0.6}
16
+ * />
17
+ * </MapView>
18
+ * ```
19
+ */
20
+ export default function HeatMap(props: HeatMapProps): React.JSX.Element;
21
+ //# sourceMappingURL=HeatMap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HeatMap.d.ts","sourceRoot":"","sources":["../../../src/components/overlays/HeatMap.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAIhD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,KAAK,EAAE,YAAY,qBAElD"}
@@ -0,0 +1,34 @@
1
+ /*
2
+ * @Author : 尚博信_王强 wangqiang03@sunboxsoft.com
3
+ * @Date : 2025-11-13 15:02:15
4
+ * @LastEditors : 尚博信_王强 wangqiang03@sunboxsoft.com
5
+ * @LastEditTime : 2025-11-13 18:12:07
6
+ * @FilePath : /expo-gaode-map/src/components/overlays/HeatMap.tsx
7
+ * @Description : 地图热力图组件
8
+ *
9
+ * Copyright (c) 2025 by 尚博信_王强, All Rights Reserved.
10
+ */
11
+ import { requireNativeViewManager } from 'expo-modules-core';
12
+ import * as React from 'react';
13
+ const NativeHeatMap = requireNativeViewManager('ExpoGaodeMap_HeatMapView');
14
+ /**
15
+ * 地图热力图组件
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * <MapView>
20
+ * <HeatMap
21
+ * data={[
22
+ * { latitude: 39.9, longitude: 116.4, intensity: 100 },
23
+ * { latitude: 39.91, longitude: 116.41, intensity: 80 },
24
+ * ]}
25
+ * radius={50}
26
+ * opacity={0.6}
27
+ * />
28
+ * </MapView>
29
+ * ```
30
+ */
31
+ export default function HeatMap(props) {
32
+ return <NativeHeatMap {...props}/>;
33
+ }
34
+ //# sourceMappingURL=HeatMap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HeatMap.js","sourceRoot":"","sources":["../../../src/components/overlays/HeatMap.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,aAAa,GAAG,wBAAwB,CAAC,0BAA0B,CAAC,CAAC;AAE3E;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,KAAmB;IACjD,OAAO,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AACtC,CAAC","sourcesContent":["/*\n * @Author : 尚博信_王强 wangqiang03@sunboxsoft.com\n * @Date : 2025-11-13 15:02:15\n * @LastEditors : 尚博信_王强 wangqiang03@sunboxsoft.com\n * @LastEditTime : 2025-11-13 18:12:07\n * @FilePath : /expo-gaode-map/src/components/overlays/HeatMap.tsx\n * @Description : 地图热力图组件\n * \n * Copyright (c) 2025 by 尚博信_王强, All Rights Reserved. \n */\n\nimport { requireNativeViewManager } from 'expo-modules-core';\nimport * as React from 'react';\nimport type { HeatMapProps } from '../../types';\n\nconst NativeHeatMap = requireNativeViewManager('ExpoGaodeMap_HeatMapView');\n\n/**\n * 地图热力图组件\n * \n * @example\n * ```tsx\n * <MapView>\n * <HeatMap\n * data={[\n * { latitude: 39.9, longitude: 116.4, intensity: 100 },\n * { latitude: 39.91, longitude: 116.41, intensity: 80 },\n * ]}\n * radius={50}\n * opacity={0.6}\n * />\n * </MapView>\n * ```\n */\nexport default function HeatMap(props: HeatMapProps) {\n return <NativeHeatMap {...props} />;\n}\n"]}
@@ -0,0 +1,17 @@
1
+ import type { MarkerProps } from '../../types';
2
+ /**
3
+ * 地图标记组件
4
+ *
5
+ * @example
6
+ * ```tsx
7
+ * <MapView>
8
+ * <Marker
9
+ * position={{ latitude: 39.9, longitude: 116.4 }}
10
+ * title="标记点"
11
+ * onPress={() => console.log('Marker pressed')}
12
+ * />
13
+ * </MapView>
14
+ * ```
15
+ */
16
+ export default function Marker(props: MarkerProps): null;
17
+ //# sourceMappingURL=Marker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Marker.d.ts","sourceRoot":"","sources":["../../../src/components/overlays/Marker.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,WAAW,QAoChD"}
@@ -0,0 +1,57 @@
1
+ /*
2
+ * @Author : 尚博信_王强 wangqiang03@sunboxsoft.com
3
+ * @Date : 2025-11-13 15:01:10
4
+ * @LastEditors : 尚博信_王强 wangqiang03@sunboxsoft.com
5
+ * @LastEditTime : 2025-11-13 18:55:00
6
+ * @FilePath : /expo-gaode-map/src/components/overlays/Marker.tsx
7
+ * @Description : 地图标记组件 - 使用命令式 API
8
+ *
9
+ * Copyright (c) 2025 by 尚博信_王强, All Rights Reserved.
10
+ */
11
+ import * as React from 'react';
12
+ import { MapContext } from '../../ExpoGaodeMapView';
13
+ /**
14
+ * 地图标记组件
15
+ *
16
+ * @example
17
+ * ```tsx
18
+ * <MapView>
19
+ * <Marker
20
+ * position={{ latitude: 39.9, longitude: 116.4 }}
21
+ * title="标记点"
22
+ * onPress={() => console.log('Marker pressed')}
23
+ * />
24
+ * </MapView>
25
+ * ```
26
+ */
27
+ export default function Marker(props) {
28
+ const mapRef = React.useContext(MapContext);
29
+ const markerIdRef = React.useRef(`marker_${Date.now()}_${Math.random()}`);
30
+ console.log('Marker 组件渲染,props:', props);
31
+ // 添加标记
32
+ React.useEffect(() => {
33
+ const markerId = markerIdRef.current;
34
+ console.log('Marker useEffect - 添加标记到地图');
35
+ mapRef?.current?.addMarker?.(markerId, props).then(() => {
36
+ console.log('✅ 标记已添加:', markerId);
37
+ }).catch((error) => {
38
+ console.error('❌ 添加标记失败:', error);
39
+ });
40
+ return () => {
41
+ console.log('Marker useEffect cleanup - 移除标记');
42
+ mapRef?.current?.removeMarker?.(markerId).catch((error) => {
43
+ console.error('❌ 移除标记失败:', error);
44
+ });
45
+ };
46
+ }, []);
47
+ // 监听 Props 变化,更新标记
48
+ React.useEffect(() => {
49
+ const markerId = markerIdRef.current;
50
+ console.log('Marker props 变化,更新标记:', props);
51
+ mapRef?.current?.updateMarker?.(markerId, props).catch((error) => {
52
+ console.error('❌ 更新标记失败:', error);
53
+ });
54
+ }, [props.position, props.title, props.draggable]);
55
+ return null;
56
+ }
57
+ //# sourceMappingURL=Marker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Marker.js","sourceRoot":"","sources":["../../../src/components/overlays/Marker.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAw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ErC,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE,KAAK,CAAC,CAAC;QAC5C,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,KAAU,EAAE,EAAE;YACpE,OAAO,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;IAEnD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["/*\n * @Author : 尚博信_王强 wangqiang03@sunboxsoft.com\n * @Date : 2025-11-13 15:01:10\n * @LastEditors : 尚博信_王强 wangqiang03@sunboxsoft.com\n * @LastEditTime : 2025-11-13 18:55:00\n * @FilePath : /expo-gaode-map/src/components/overlays/Marker.tsx\n * @Description : 地图标记组件 - 使用命令式 API\n * \n * Copyright (c) 2025 by 尚博信_王强, All Rights Reserved. \n */\n\nimport * as React from 'react';\nimport { MapContext } from '../../ExpoGaodeMapView';\nimport type { MarkerProps } from '../../types';\n\n/**\n * 地图标记组件\n * \n * @example\n * ```tsx\n * <MapView>\n * <Marker\n * position={{ latitude: 39.9, longitude: 116.4 }}\n * title=\"标记点\"\n * onPress={() => console.log('Marker pressed')}\n * />\n * </MapView>\n * ```\n */\nexport default function Marker(props: MarkerProps) {\n const mapRef = React.useContext(MapContext);\n const markerIdRef = React.useRef<string>(`marker_${Date.now()}_${Math.random()}`);\n\n console.log('Marker 组件渲染,props:', props);\n\n // 添加标记\n React.useEffect(() => {\n const markerId = markerIdRef.current;\n \n console.log('Marker useEffect - 添加标记到地图');\n mapRef?.current?.addMarker?.(markerId, props).then(() => {\n console.log('✅ 标记已添加:', markerId);\n }).catch((error: any) => {\n console.error('❌ 添加标记失败:', error);\n });\n\n return () => {\n console.log('Marker useEffect cleanup - 移除标记');\n mapRef?.current?.removeMarker?.(markerId).catch((error: any) => {\n console.error('❌ 移除标记失败:', error);\n });\n };\n }, []);\n\n // 监听 Props 变化,更新标记\n React.useEffect(() => {\n const markerId = markerIdRef.current;\n \n console.log('Marker props 变化,更新标记:', props);\n mapRef?.current?.updateMarker?.(markerId, props).catch((error: any) => {\n console.error('❌ 更新标记失败:', error);\n });\n }, [props.position, props.title, props.draggable]);\n\n return null;\n}\n"]}
@@ -0,0 +1,21 @@
1
+ import * as React from 'react';
2
+ import type { MultiPointProps } from '../../types';
3
+ /**
4
+ * 地图海量点组件
5
+ * 用于展示大量标记点,性能优于普通 Marker
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * <MapView>
10
+ * <MultiPoint
11
+ * points={[
12
+ * { latitude: 39.9, longitude: 116.4, id: '1' },
13
+ * { latitude: 39.91, longitude: 116.41, id: '2' },
14
+ * ]}
15
+ * icon={require('./marker.png')}
16
+ * />
17
+ * </MapView>
18
+ * ```
19
+ */
20
+ export default function MultiPoint(props: MultiPointProps): React.JSX.Element;
21
+ //# sourceMappingURL=MultiPoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MultiPoint.d.ts","sourceRoot":"","sources":["../../../src/components/overlays/MultiPoint.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAInD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,KAAK,EAAE,eAAe,qBAExD"}
@@ -0,0 +1,34 @@
1
+ /*
2
+ * @Author : 尚博信_王强 wangqiang03@sunboxsoft.com
3
+ * @Date : 2025-11-13 15:02:35
4
+ * @LastEditors : 尚博信_王强 wangqiang03@sunboxsoft.com
5
+ * @LastEditTime : 2025-11-13 18:19:09
6
+ * @FilePath : /expo-gaode-map/src/components/overlays/MultiPoint.tsx
7
+ * @Description : 地图海量点组件
8
+ *
9
+ * Copyright (c) 2025 by 尚博信_王强, All Rights Reserved.
10
+ */
11
+ import { requireNativeViewManager } from 'expo-modules-core';
12
+ import * as React from 'react';
13
+ const NativeMultiPoint = requireNativeViewManager('ExpoGaodeMap_MultiPointView');
14
+ /**
15
+ * 地图海量点组件
16
+ * 用于展示大量标记点,性能优于普通 Marker
17
+ *
18
+ * @example
19
+ * ```tsx
20
+ * <MapView>
21
+ * <MultiPoint
22
+ * points={[
23
+ * { latitude: 39.9, longitude: 116.4, id: '1' },
24
+ * { latitude: 39.91, longitude: 116.41, id: '2' },
25
+ * ]}
26
+ * icon={require('./marker.png')}
27
+ * />
28
+ * </MapView>
29
+ * ```
30
+ */
31
+ export default function MultiPoint(props) {
32
+ return <NativeMultiPoint {...props}/>;
33
+ }
34
+ //# sourceMappingURL=MultiPoint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MultiPoint.js","sourceRoot":"","sources":["../../../src/components/overlays/MultiPoint.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,gBAAgB,GAAG,wBAAwB,CAAC,6BAA6B,CAAC,CAAC;AAEjF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,KAAsB;IACvD,OAAO,CAAC,gBAAgB,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AACzC,CAAC","sourcesContent":["/*\n * @Author : 尚博信_王强 wangqiang03@sunboxsoft.com\n * @Date : 2025-11-13 15:02:35\n * @LastEditors : 尚博信_王强 wangqiang03@sunboxsoft.com\n * @LastEditTime : 2025-11-13 18:19:09\n * @FilePath : /expo-gaode-map/src/components/overlays/MultiPoint.tsx\n * @Description : 地图海量点组件\n * \n * Copyright (c) 2025 by 尚博信_王强, All Rights Reserved. \n */\n\nimport { requireNativeViewManager } from 'expo-modules-core';\nimport * as React from 'react';\nimport type { MultiPointProps } from '../../types';\n\nconst NativeMultiPoint = requireNativeViewManager('ExpoGaodeMap_MultiPointView');\n\n/**\n * 地图海量点组件\n * 用于展示大量标记点,性能优于普通 Marker\n * \n * @example\n * ```tsx\n * <MapView>\n * <MultiPoint\n * points={[\n * { latitude: 39.9, longitude: 116.4, id: '1' },\n * { latitude: 39.91, longitude: 116.41, id: '2' },\n * ]}\n * icon={require('./marker.png')}\n * />\n * </MapView>\n * ```\n */\nexport default function MultiPoint(props: MultiPointProps) {\n return <NativeMultiPoint {...props} />;\n}\n"]}
@@ -0,0 +1,22 @@
1
+ import type { PolygonProps } from '../../types';
2
+ /**
3
+ * 地图多边形组件 - 命令式 API
4
+ *
5
+ * @example
6
+ * ```tsx
7
+ * <MapView>
8
+ * <Polygon
9
+ * points={[
10
+ * { latitude: 39.9, longitude: 116.4 },
11
+ * { latitude: 39.91, longitude: 116.41 },
12
+ * { latitude: 39.92, longitude: 116.40 },
13
+ * ]}
14
+ * fillColor={0x44FF0000}
15
+ * strokeColor={-65536}
16
+ * strokeWidth={5}
17
+ * />
18
+ * </MapView>
19
+ * ```
20
+ */
21
+ export default function Polygon(props: PolygonProps): null;
22
+ //# sourceMappingURL=Polygon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Polygon.d.ts","sourceRoot":"","sources":["../../../src/components/overlays/Polygon.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGhD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,KAAK,EAAE,YAAY,QAuElD"}
@@ -0,0 +1,100 @@
1
+ /*
2
+ * @Author : 尚博信_王强 wangqiang03@sunboxsoft.com
3
+ * @Date : 2025-11-13 15:01:45
4
+ * @LastEditors : 尚博信_王强 wangqiang03@sunboxsoft.com
5
+ * @LastEditTime : 2025-11-13 19:24:22
6
+ * @FilePath : /expo-gaode-map/src/components/overlays/Polygon.tsx
7
+ * @Description : 地图多边形组件 - 命令式 API
8
+ *
9
+ * Copyright (c) 2025 by 尚博信_王强, All Rights Reserved.
10
+ */
11
+ import { useContext, useEffect, useRef } from 'react';
12
+ import { MapContext } from '../../ExpoGaodeMapView';
13
+ /**
14
+ * 地图多边形组件 - 命令式 API
15
+ *
16
+ * @example
17
+ * ```tsx
18
+ * <MapView>
19
+ * <Polygon
20
+ * points={[
21
+ * { latitude: 39.9, longitude: 116.4 },
22
+ * { latitude: 39.91, longitude: 116.41 },
23
+ * { latitude: 39.92, longitude: 116.40 },
24
+ * ]}
25
+ * fillColor={0x44FF0000}
26
+ * strokeColor={-65536}
27
+ * strokeWidth={5}
28
+ * />
29
+ * </MapView>
30
+ * ```
31
+ */
32
+ export default function Polygon(props) {
33
+ const { points, fillColor, strokeColor, strokeWidth, zIndex } = props;
34
+ const nativeRef = useContext(MapContext);
35
+ const polygonIdRef = useRef(`polygon_${Date.now()}_${Math.random()}`);
36
+ useEffect(() => {
37
+ const polygonId = polygonIdRef.current;
38
+ // 添加多边形
39
+ if (nativeRef?.current && points && points.length >= 3) {
40
+ try {
41
+ console.log('🟦 Polygon 组件调用 addPolygon:', polygonId, {
42
+ points,
43
+ fillColor: fillColor ?? 0x440000FF,
44
+ strokeColor: strokeColor ?? -16776961,
45
+ strokeWidth: strokeWidth ?? 10,
46
+ zIndex: zIndex ?? 0,
47
+ });
48
+ nativeRef.current.addPolygon(polygonId, {
49
+ points,
50
+ fillColor: fillColor ?? 0x440000FF,
51
+ strokeColor: strokeColor ?? -16776961,
52
+ strokeWidth: strokeWidth ?? 10,
53
+ zIndex: zIndex ?? 0,
54
+ });
55
+ console.log('✅ Polygon addPolygon 调用完成');
56
+ }
57
+ catch (error) {
58
+ console.error('❌ 添加多边形失败:', error);
59
+ }
60
+ }
61
+ else {
62
+ console.warn('⚠️ Polygon 组件条件不满足:', {
63
+ hasNativeRef: !!nativeRef?.current,
64
+ hasPoints: !!points,
65
+ pointsLength: points?.length,
66
+ });
67
+ }
68
+ // 清理函数
69
+ return () => {
70
+ if (nativeRef?.current) {
71
+ try {
72
+ nativeRef.current.removePolygon(polygonId);
73
+ }
74
+ catch (error) {
75
+ console.error('移除多边形失败:', error);
76
+ }
77
+ }
78
+ };
79
+ }, []);
80
+ // 更新多边形属性
81
+ useEffect(() => {
82
+ const polygonId = polygonIdRef.current;
83
+ if (nativeRef?.current) {
84
+ try {
85
+ nativeRef.current.updatePolygon(polygonId, {
86
+ points,
87
+ fillColor,
88
+ strokeColor,
89
+ strokeWidth,
90
+ zIndex,
91
+ });
92
+ }
93
+ catch (error) {
94
+ console.error('更新多边形失败:', error);
95
+ }
96
+ }
97
+ }, [points, fillColor, strokeColor, strokeWidth, zIndex]);
98
+ return null;
99
+ }
100
+ //# sourceMappingURL=Polygon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Polygon.js","sourceRoot":"","sources":["../../../src/components/overlays/Polygon.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,KAAmB;IACjD,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IACtE,MAAM,SAAS,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;IACzC,MAAM,YAAY,GAAG,MAAM,CAAS,WAAW,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAE9E,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,SAAS,GAAG,YAAY,CAAC,OAAO,CAAC;QAEvC,QAAQ;QACR,IAAI,S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gBACnC,CAAC;YACH,CAAC;QACH,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,UAAU;IACV,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,SAAS,GAAG,YAAY,CAAC,OAAO,CAAC;QAEvC,IAAI,SAAS,EAAE,OAAO,EAAE,CAAC;YACvB,IAAI,CAAC;gBACH,SAAS,CAAC,OAAO,CAAC,aAAa,CAAC,SAAS,EAAE;oBACzC,MAAM;oBACN,SAAS;oBACT,WAAW;oBACX,WAAW;oBACX,MAAM;iBACP,CAAC,CAAC;YACL,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;YACnC,CAAC;QACH,CAAC;IACH,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;IAE1D,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["/*\n * @Author : 尚博信_王强 wangqiang03@sunboxsoft.com\n * @Date : 2025-11-13 15:01:45\n * @LastEditors : 尚博信_王强 wangqiang03@sunboxsoft.com\n * @LastEditTime : 2025-11-13 19:24:22\n * @FilePath : /expo-gaode-map/src/components/overlays/Polygon.tsx\n * @Description : 地图多边形组件 - 命令式 API\n * \n * Copyright (c) 2025 by 尚博信_王强, All Rights Reserved. \n */\n\n\nimport { useContext, useEffect, useRef } from 'react';\nimport type { PolygonProps } from '../../types';\nimport { MapContext } from '../../ExpoGaodeMapView';\n\n/**\n * 地图多边形组件 - 命令式 API\n * \n * @example\n * ```tsx\n * <MapView>\n * <Polygon\n * points={[\n * { latitude: 39.9, longitude: 116.4 },\n * { latitude: 39.91, longitude: 116.41 },\n * { latitude: 39.92, longitude: 116.40 },\n * ]}\n * fillColor={0x44FF0000}\n * strokeColor={-65536}\n * strokeWidth={5}\n * />\n * </MapView>\n * ```\n */\nexport default function Polygon(props: PolygonProps) {\n const { points, fillColor, strokeColor, strokeWidth, zIndex } = props;\n const nativeRef = useContext(MapContext);\n const polygonIdRef = useRef<string>(`polygon_${Date.now()}_${Math.random()}`);\n\n useEffect(() => {\n const polygonId = polygonIdRef.current;\n\n // 添加多边形\n if (nativeRef?.current && points && points.length >= 3) {\n try {\n console.log('🟦 Polygon 组件调用 addPolygon:', polygonId, {\n points,\n fillColor: fillColor ?? 0x440000FF,\n strokeColor: strokeColor ?? -16776961,\n strokeWidth: strokeWidth ?? 10,\n zIndex: zIndex ?? 0,\n });\n \n nativeRef.current.addPolygon(polygonId, {\n points,\n fillColor: fillColor ?? 0x440000FF,\n strokeColor: strokeColor ?? -16776961,\n strokeWidth: strokeWidth ?? 10,\n zIndex: zIndex ?? 0,\n });\n \n console.log('✅ Polygon addPolygon 调用完成');\n } catch (error) {\n console.error('❌ 添加多边形失败:', error);\n }\n } else {\n console.warn('⚠️ Polygon 组件条件不满足:', {\n hasNativeRef: !!nativeRef?.current,\n hasPoints: !!points,\n pointsLength: points?.length,\n });\n }\n\n // 清理函数\n return () => {\n if (nativeRef?.current) {\n try {\n nativeRef.current.removePolygon(polygonId);\n } catch (error) {\n console.error('移除多边形失败:', error);\n }\n }\n };\n }, []);\n\n // 更新多边形属性\n useEffect(() => {\n const polygonId = polygonIdRef.current;\n\n if (nativeRef?.current) {\n try {\n nativeRef.current.updatePolygon(polygonId, {\n points,\n fillColor,\n strokeColor,\n strokeWidth,\n zIndex,\n });\n } catch (error) {\n console.error('更新多边形失败:', error);\n }\n }\n }, [points, fillColor, strokeColor, strokeWidth, zIndex]);\n\n return null;\n}\n"]}
@@ -0,0 +1,20 @@
1
+ import type { PolylineProps } from '../../types';
2
+ /**
3
+ * 地图折线组件
4
+ *
5
+ * @example
6
+ * ```tsx
7
+ * <MapView>
8
+ * <Polyline
9
+ * points={[
10
+ * { latitude: 39.9, longitude: 116.4 },
11
+ * { latitude: 39.91, longitude: 116.41 },
12
+ * ]}
13
+ * color="#FF0000"
14
+ * width={5}
15
+ * />
16
+ * </MapView>
17
+ * ```
18
+ */
19
+ export default function Polyline(props: PolylineProps): null;
20
+ //# sourceMappingURL=Polyline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Polyline.d.ts","sourceRoot":"","sources":["../../../src/components/overlays/Polyline.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,KAAK,EAAE,aAAa,QAoCpD"}
@@ -0,0 +1,60 @@
1
+ /*
2
+ * @Author : 尚博信_王强 wangqiang03@sunboxsoft.com
3
+ * @Date : 2025-11-13 15:01:30
4
+ * @LastEditors : 尚博信_王强 wangqiang03@sunboxsoft.com
5
+ * @LastEditTime : 2025-11-13 19:06:00
6
+ * @FilePath : /expo-gaode-map/src/components/overlays/Polyline.tsx
7
+ * @Description : 地图折线组件 - 使用命令式 API
8
+ *
9
+ * Copyright (c) 2025 by 尚博信_王强, All Rights Reserved.
10
+ */
11
+ import * as React from 'react';
12
+ import { MapContext } from '../../ExpoGaodeMapView';
13
+ /**
14
+ * 地图折线组件
15
+ *
16
+ * @example
17
+ * ```tsx
18
+ * <MapView>
19
+ * <Polyline
20
+ * points={[
21
+ * { latitude: 39.9, longitude: 116.4 },
22
+ * { latitude: 39.91, longitude: 116.41 },
23
+ * ]}
24
+ * color="#FF0000"
25
+ * width={5}
26
+ * />
27
+ * </MapView>
28
+ * ```
29
+ */
30
+ export default function Polyline(props) {
31
+ const mapRef = React.useContext(MapContext);
32
+ const polylineIdRef = React.useRef(`polyline_${Date.now()}_${Math.random()}`);
33
+ console.log('Polyline 组件渲染,props:', props);
34
+ // 添加折线
35
+ React.useEffect(() => {
36
+ const polylineId = polylineIdRef.current;
37
+ console.log('Polyline useEffect - 添加折线到地图');
38
+ mapRef?.current?.addPolyline?.(polylineId, props).then(() => {
39
+ console.log('✅ 折线已添加:', polylineId);
40
+ }).catch((error) => {
41
+ console.error('❌ 添加折线失败:', error);
42
+ });
43
+ return () => {
44
+ console.log('Polyline useEffect cleanup - 移除折线');
45
+ mapRef?.current?.removePolyline?.(polylineId).catch((error) => {
46
+ console.error('❌ 移除折线失败:', error);
47
+ });
48
+ };
49
+ }, []);
50
+ // 监听 Props 变化,更新折线
51
+ React.useEffect(() => {
52
+ const polylineId = polylineIdRef.current;
53
+ console.log('Polyline props 变化,更新折线:', props);
54
+ mapRef?.current?.updatePolyline?.(polylineId, props).catch((error) => {
55
+ console.error('❌ 更新折线失败:', error);
56
+ });
57
+ }, [props.points, props.width, props.color]);
58
+ return null;
59
+ }
60
+ //# sourceMappingURL=Polyline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Polyline.js","sourceRoot":"","sources":["../../../src/components/overlays/Polyline.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGpD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,KAAoB;IACnD,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IAC5C,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CAAS,YAAY,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAEtF,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE,KAAK,CAAC,CAAC;IAE3C,OAAO;IACP,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,UAAU,GAAG,aAAa,CAAC,OAAO,CAAC;QAEzC,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;QAC5C,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;YAC1D,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QACtC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAU,EAAE,EAAE;YACtB,OAAO,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;QAEH,OAAO,GAAG,EAAE;YACV,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;YACjD,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC,KAAU,EAAE,EAAE;gBACjE,OAAO,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;YACpC,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,mBAAmB;IACnB,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,UAAU,GAAG,aAAa,CAAC,OAAO,CAAC;QAEzC,OAAO,CAAC,GAAG,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC;QAC9C,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,KAAU,EAAE,EAAE;YACxE,OAAO,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IAE7C,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["/*\n * @Author : 尚博信_王强 wangqiang03@sunboxsoft.com\n * @Date : 2025-11-13 15:01:30\n * @LastEditors : 尚博信_王强 wangqiang03@sunboxsoft.com\n * @LastEditTime : 2025-11-13 19:06:00\n * @FilePath : /expo-gaode-map/src/components/overlays/Polyline.tsx\n * @Description : 地图折线组件 - 使用命令式 API\n * \n * Copyright (c) 2025 by 尚博信_王强, All Rights Reserved. \n */\n\nimport * as React from 'react';\nimport { MapContext } from '../../ExpoGaodeMapView';\nimport type { PolylineProps } from '../../types';\n\n/**\n * 地图折线组件\n * \n * @example\n * ```tsx\n * <MapView>\n * <Polyline\n * points={[\n * { latitude: 39.9, longitude: 116.4 },\n * { latitude: 39.91, longitude: 116.41 },\n * ]}\n * color=\"#FF0000\"\n * width={5}\n * />\n * </MapView>\n * ```\n */\nexport default function Polyline(props: PolylineProps) {\n const mapRef = React.useContext(MapContext);\n const polylineIdRef = React.useRef<string>(`polyline_${Date.now()}_${Math.random()}`);\n\n console.log('Polyline 组件渲染,props:', props);\n\n // 添加折线\n React.useEffect(() => {\n const polylineId = polylineIdRef.current;\n \n console.log('Polyline useEffect - 添加折线到地图');\n mapRef?.current?.addPolyline?.(polylineId, props).then(() => {\n console.log('✅ 折线已添加:', polylineId);\n }).catch((error: any) => {\n console.error('❌ 添加折线失败:', error);\n });\n\n return () => {\n console.log('Polyline useEffect cleanup - 移除折线');\n mapRef?.current?.removePolyline?.(polylineId).catch((error: any) => {\n console.error('❌ 移除折线失败:', error);\n });\n };\n }, []);\n\n // 监听 Props 变化,更新折线\n React.useEffect(() => {\n const polylineId = polylineIdRef.current;\n \n console.log('Polyline props 变化,更新折线:', props);\n mapRef?.current?.updatePolyline?.(polylineId, props).catch((error: any) => {\n console.error('❌ 更新折线失败:', error);\n });\n }, [props.points, props.width, props.color]);\n\n return null;\n}\n"]}
@@ -0,0 +1,8 @@
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';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/overlays/index.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,18 @@
1
+ /*
2
+ * @Author : 尚博信_王强 wangqiang03@sunboxsoft.com
3
+ * @Date : 2025-11-13 15:03:10
4
+ * @LastEditors : 尚博信_王强 wangqiang03@sunboxsoft.com
5
+ * @LastEditTime : 2025-11-13 15:03:22
6
+ * @FilePath : /expo-gaode-map/src/components/overlays/index.ts
7
+ * @Description : 覆盖物组件统一导出
8
+ *
9
+ * Copyright (c) 2025 by 尚博信_王强, All Rights Reserved.
10
+ */
11
+ export { default as Marker } from './Marker';
12
+ export { default as Polyline } from './Polyline';
13
+ export { default as Polygon } from './Polygon';
14
+ export { default as Circle } from './Circle';
15
+ export { default as HeatMap } from './HeatMap';
16
+ export { default as MultiPoint } from './MultiPoint';
17
+ export { default as Cluster } from './Cluster';
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/overlays/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC","sourcesContent":["/*\n * @Author : 尚博信_王强 wangqiang03@sunboxsoft.com\n * @Date : 2025-11-13 15:03:10\n * @LastEditors : 尚博信_王强 wangqiang03@sunboxsoft.com\n * @LastEditTime : 2025-11-13 15:03:22\n * @FilePath : /expo-gaode-map/src/components/overlays/index.ts\n * @Description : 覆盖物组件统一导出\n * \n * Copyright (c) 2025 by 尚博信_王强, All Rights Reserved. \n */\n\nexport { default as Marker } from './Marker';\nexport { default as Polyline } from './Polyline';\nexport { default as Polygon } from './Polygon';\nexport { default as Circle } from './Circle';\nexport { default as HeatMap } from './HeatMap';\nexport { default as MultiPoint } from './MultiPoint';\nexport { default as Cluster } from './Cluster';\n"]}