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,103 @@
1
+ package expo.modules.gaodemap.overlays
2
+
3
+ import android.content.Context
4
+
5
+ import com.amap.api.maps.AMap
6
+ import com.amap.api.maps.model.BitmapDescriptorFactory
7
+ import com.amap.api.maps.model.LatLng
8
+ import com.amap.api.maps.model.MultiPointItem
9
+ import com.amap.api.maps.model.MultiPointOverlay
10
+ import com.amap.api.maps.model.MultiPointOverlayOptions
11
+ import expo.modules.kotlin.AppContext
12
+ import expo.modules.kotlin.viewevent.EventDispatcher
13
+ import expo.modules.kotlin.views.ExpoView
14
+
15
+ class MultiPointView(context: Context, appContext: AppContext) : ExpoView(context, appContext) {
16
+
17
+ private val onPress by EventDispatcher()
18
+
19
+ private var multiPointOverlay: MultiPointOverlay? = null
20
+ private var aMap: AMap? = null
21
+ private var points: MutableList<MultiPointItem> = mutableListOf()
22
+
23
+ /**
24
+ * 设置地图实例
25
+ */
26
+ fun setMap(map: AMap) {
27
+ aMap = map
28
+ createOrUpdateMultiPoint()
29
+ }
30
+
31
+ /**
32
+ * 设置海量点数据
33
+ */
34
+ fun setPoints(pointsList: List<Map<String, Any>>) {
35
+ points.clear()
36
+ pointsList.forEach { point ->
37
+ val lat = (point["latitude"] as? Number)?.toDouble()
38
+ val lng = (point["longitude"] as? Number)?.toDouble()
39
+ val id = point["id"] as? String ?: ""
40
+
41
+ if (lat != null && lng != null) {
42
+ val multiPointItem = MultiPointItem(LatLng(lat, lng))
43
+ multiPointItem.customerId = id
44
+ points.add(multiPointItem)
45
+ }
46
+ }
47
+ createOrUpdateMultiPoint()
48
+ }
49
+
50
+ /**
51
+ * 设置图标
52
+ */
53
+ fun setIcon(iconUri: String?) {
54
+ // 简化处理,实际需要实现图片加载
55
+ createOrUpdateMultiPoint()
56
+ }
57
+
58
+ /**
59
+ * 设置锚点
60
+ */
61
+ fun setAnchor(anchor: Map<String, Float>) {
62
+ val x = anchor["x"] ?: 0.5f
63
+ val y = anchor["y"] ?: 0.5f
64
+ multiPointOverlay?.setAnchor(x, y)
65
+ }
66
+
67
+ /**
68
+ * 创建或更新海量点
69
+ */
70
+ private fun createOrUpdateMultiPoint() {
71
+ aMap?.let { map ->
72
+ if (points.isNotEmpty()) {
73
+ // 移除旧的海量点
74
+ multiPointOverlay?.remove()
75
+
76
+ // 创建海量点选项
77
+ val overlayOptions = MultiPointOverlayOptions()
78
+ overlayOptions.icon(BitmapDescriptorFactory.defaultMarker())
79
+ overlayOptions.anchor(0.5f, 0.5f)
80
+
81
+ // 创建海量点覆盖物
82
+ multiPointOverlay = map.addMultiPointOverlay(overlayOptions)
83
+ multiPointOverlay?.setItems(points)
84
+
85
+ // 注意:MultiPointOverlay 在高德地图 Android SDK 中不直接支持点击事件
86
+ // 如果需要点击事件,需要使用 Marker 或其他方式实现
87
+ }
88
+ }
89
+ }
90
+
91
+ /**
92
+ * 移除海量点
93
+ */
94
+ fun removeMultiPoint() {
95
+ multiPointOverlay?.remove()
96
+ multiPointOverlay = null
97
+ }
98
+
99
+ override fun onDetachedFromWindow() {
100
+ super.onDetachedFromWindow()
101
+ removeMultiPoint()
102
+ }
103
+ }
@@ -0,0 +1,114 @@
1
+ package expo.modules.gaodemap.overlays
2
+
3
+ import android.content.Context
4
+ import android.graphics.Color
5
+ import com.amap.api.maps.AMap
6
+ import com.amap.api.maps.model.LatLng
7
+ import com.amap.api.maps.model.Polygon
8
+ import com.amap.api.maps.model.PolygonOptions
9
+ import expo.modules.kotlin.AppContext
10
+ import expo.modules.kotlin.viewevent.EventDispatcher
11
+ import expo.modules.kotlin.views.ExpoView
12
+
13
+ class PolygonView(context: Context, appContext: AppContext) : ExpoView(context, appContext) {
14
+
15
+ private val onPress by EventDispatcher()
16
+
17
+ private var polygon: Polygon? = null
18
+ private var aMap: AMap? = null
19
+ private var points: List<LatLng> = emptyList()
20
+
21
+ /**
22
+ * 设置地图实例
23
+ */
24
+ @Suppress("unused")
25
+ fun setMap(map: AMap) {
26
+ aMap = map
27
+ createOrUpdatePolygon()
28
+ }
29
+
30
+ /**
31
+ * 设置多边形点集合
32
+ */
33
+ fun setPoints(pointsList: List<Map<String, Double>>) {
34
+ points = pointsList.mapNotNull { point ->
35
+ val lat = point["latitude"]
36
+ val lng = point["longitude"]
37
+ if (lat != null && lng != null) {
38
+ LatLng(lat, lng)
39
+ } else null
40
+ }
41
+ polygon?.let {
42
+ it.points = points
43
+ } ?: createOrUpdatePolygon()
44
+ }
45
+
46
+ /**
47
+ * 设置填充颜色
48
+ */
49
+ fun setFillColor(color: Int) {
50
+ polygon?.let {
51
+ it.fillColor = color
52
+ } ?: createOrUpdatePolygon()
53
+ }
54
+
55
+ /**
56
+ * 设置边框颜色
57
+ */
58
+ fun setStrokeColor(color: Int) {
59
+ polygon?.let {
60
+ it.strokeColor = color
61
+ } ?: createOrUpdatePolygon()
62
+ }
63
+
64
+ /**
65
+ * 设置边框宽度
66
+ */
67
+ fun setStrokeWidth(width: Float) {
68
+ polygon?.let {
69
+ it.strokeWidth = width
70
+ } ?: createOrUpdatePolygon()
71
+ }
72
+
73
+ /**
74
+ * 设置 z-index
75
+ */
76
+ fun setZIndex(zIndex: Float) {
77
+ polygon?.let {
78
+ it.zIndex = zIndex
79
+ } ?: createOrUpdatePolygon()
80
+ }
81
+
82
+ /**
83
+ * 创建或更新多边形
84
+ */
85
+ private fun createOrUpdatePolygon() {
86
+ aMap?.let { map ->
87
+ if (polygon == null && points.isNotEmpty()) {
88
+ val options = PolygonOptions()
89
+ .addAll(points)
90
+ .fillColor(Color.argb(50, 0, 0, 255))
91
+ .strokeColor(Color.BLUE)
92
+ .strokeWidth(10f)
93
+
94
+ polygon = map.addPolygon(options)
95
+
96
+ // 注意:高德地图 Android SDK 不直接支持 Polygon 点击事件
97
+ // 如果需要点击事件,需要通过其他方式实现
98
+ }
99
+ }
100
+ }
101
+
102
+ /**
103
+ * 移除多边形
104
+ */
105
+ fun removePolygon() {
106
+ polygon?.remove()
107
+ polygon = null
108
+ }
109
+
110
+ override fun onDetachedFromWindow() {
111
+ super.onDetachedFromWindow()
112
+ removePolygon()
113
+ }
114
+ }
@@ -0,0 +1,138 @@
1
+ package expo.modules.gaodemap.overlays
2
+
3
+ import android.content.Context
4
+ import android.graphics.Color
5
+ import com.amap.api.maps.AMap
6
+ import com.amap.api.maps.model.LatLng
7
+ import com.amap.api.maps.model.Polyline
8
+ import com.amap.api.maps.model.PolylineOptions
9
+ import expo.modules.kotlin.AppContext
10
+ import expo.modules.kotlin.viewevent.EventDispatcher
11
+ import expo.modules.kotlin.views.ExpoView
12
+
13
+ class PolylineView(context: Context, appContext: AppContext) : ExpoView(context, appContext) {
14
+
15
+ private val onPress by EventDispatcher()
16
+
17
+ private var polyline: Polyline? = null
18
+ private var aMap: AMap? = null
19
+ private var points: List<LatLng> = emptyList()
20
+
21
+ /**
22
+ * 设置地图实例
23
+ */
24
+ @Suppress("unused")
25
+ fun setMap(map: AMap) {
26
+ aMap = map
27
+ createOrUpdatePolyline()
28
+ }
29
+
30
+ /**
31
+ * 设置折线点集合
32
+ */
33
+ fun setPoints(pointsList: List<Map<String, Double>>) {
34
+ points = pointsList.mapNotNull { point ->
35
+ val lat = point["latitude"]
36
+ val lng = point["longitude"]
37
+ if (lat != null && lng != null) {
38
+ LatLng(lat, lng)
39
+ } else null
40
+ }
41
+ polyline?.let {
42
+ it.points = points
43
+ } ?: createOrUpdatePolyline()
44
+ }
45
+
46
+ /**
47
+ * 设置线宽
48
+ */
49
+ fun setStrokeWidth(width: Float) {
50
+ polyline?.let {
51
+ it.width = width
52
+ } ?: createOrUpdatePolyline()
53
+ }
54
+
55
+ /**
56
+ * 设置线条颜色
57
+ */
58
+ fun setStrokeColor(color: Int) {
59
+ polyline?.let {
60
+ it.color = color
61
+ } ?: createOrUpdatePolyline()
62
+ }
63
+
64
+ /**
65
+ * 设置是否虚线
66
+ */
67
+ fun setDashed(dashed: Boolean) {
68
+ polyline?.let {
69
+ it.isDottedLine = dashed
70
+ } ?: createOrUpdatePolyline()
71
+ }
72
+
73
+ /**
74
+ * 设置是否使用渐变色
75
+ */
76
+ fun setGradient(gradient: Boolean) {
77
+ polyline?.let {
78
+ it.isGeodesic = gradient
79
+ } ?: createOrUpdatePolyline()
80
+ }
81
+
82
+ /**
83
+ * 设置 z-index
84
+ */
85
+ fun setZIndex(zIndex: Float) {
86
+ polyline?.let {
87
+ it.zIndex = zIndex
88
+ } ?: createOrUpdatePolyline()
89
+ }
90
+
91
+ /**
92
+ * 设置透明度
93
+ */
94
+ fun setOpacity(opacity: Float) {
95
+ // 通过修改颜色的 alpha 通道实现透明度
96
+ polyline?.let { line ->
97
+ val currentColor = line.color
98
+ val alpha = (opacity * 255).toInt()
99
+ line.color = Color.argb(alpha, Color.red(currentColor), Color.green(currentColor), Color.blue(currentColor))
100
+ }
101
+ }
102
+
103
+ /**
104
+ * 创建或更新折线
105
+ */
106
+ private fun createOrUpdatePolyline() {
107
+ aMap?.let { map ->
108
+ if (polyline == null && points.isNotEmpty()) {
109
+ val options = PolylineOptions()
110
+ .addAll(points)
111
+ .width(10f)
112
+ .color(Color.BLUE)
113
+
114
+ polyline = map.addPolyline(options)
115
+
116
+ // 设置点击监听
117
+ map.setOnPolylineClickListener { clickedPolyline ->
118
+ if (clickedPolyline == polyline) {
119
+ onPress(mapOf("id" to clickedPolyline.id))
120
+ }
121
+ }
122
+ }
123
+ }
124
+ }
125
+
126
+ /**
127
+ * 移除折线
128
+ */
129
+ fun removePolyline() {
130
+ polyline?.remove()
131
+ polyline = null
132
+ }
133
+
134
+ override fun onDetachedFromWindow() {
135
+ super.onDetachedFromWindow()
136
+ removePolyline()
137
+ }
138
+ }
@@ -0,0 +1,24 @@
1
+ export * from './types';
2
+ export type { LatLng, Point, CameraPosition, LatLngBounds, MapPoi, MapViewProps, CameraEvent, Coordinates, ReGeocode, LocationOptions, MarkerProps, PolylineProps, PolygonProps, CircleProps, HeatMapProps, MultiPointProps, ClusterProps, } from './types';
3
+ export { MapType, LocationMode, LocationAccuracy, CoordinateType, } from './types';
4
+ /**
5
+ * Expo 模块事件类型
6
+ */
7
+ export type ExpoGaodeMapModuleEvents = {
8
+ /**
9
+ * 定位更新事件
10
+ */
11
+ onLocationUpdate: (location: any) => void;
12
+ /**
13
+ * 定位错误事件
14
+ */
15
+ onLocationError: (error: {
16
+ code: number;
17
+ message: string;
18
+ }) => void;
19
+ };
20
+ /**
21
+ * Expo 地图视图属性(用于主视图组件)
22
+ */
23
+ export type { MapViewProps as ExpoGaodeMapViewProps } from './types';
24
+ //# sourceMappingURL=ExpoGaodeMap.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoGaodeMap.types.d.ts","sourceRoot":"","sources":["../src/ExpoGaodeMap.types.ts"],"names":[],"mappings":"AAYA,cAAc,SAAS,CAAC;AAGxB,YAAY,EAEV,MAAM,EACN,KAAK,EACL,cAAc,EACd,YAAY,EACZ,MAAM,EAGN,YAAY,EACZ,WAAW,EAGX,WAAW,EACX,SAAS,EACT,eAAe,EAGf,WAAW,EACX,aAAa,EACb,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,eAAe,EACf,YAAY,GACb,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,OAAO,EACP,YAAY,EACZ,gBAAgB,EAChB,cAAc,GACf,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC;;OAEG;IACH,gBAAgB,EAAE,CAAC,QAAQ,EAAE,GAAG,KAAK,IAAI,CAAC;IAE1C;;OAEG;IACH,eAAe,EAAE,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CACrE,CAAC;AAEF;;GAEG;AACH,YAAY,EAAE,YAAY,IAAI,qBAAqB,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,14 @@
1
+ /*
2
+ * @Author : 尚博信_王强 wangqiang03@sunboxsoft.com
3
+ * @Date : 2025-11-13 14:03:56
4
+ * @LastEditors : 尚博信_王强 wangqiang03@sunboxsoft.com
5
+ * @LastEditTime : 2025-11-13 14:30:00
6
+ * @FilePath : /expo-gaode-map/src/ExpoGaodeMap.types.ts
7
+ * @Description : 高德地图 Expo Module 主类型定义文件
8
+ *
9
+ * Copyright (c) 2025 by 尚博信_王强, All Rights Reserved.
10
+ */
11
+ // 导出所有类型定义
12
+ export * from './types';
13
+ export { MapType, LocationMode, LocationAccuracy, CoordinateType, } from './types';
14
+ //# sourceMappingURL=ExpoGaodeMap.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoGaodeMap.types.js","sourceRoot":"","sources":["../src/ExpoGaodeMap.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,WAAW;AACX,cAAc,SAAS,CAAC;AA8BxB,OAAO,EACL,OAAO,EACP,YAAY,EACZ,gBAAgB,EAChB,cAAc,GACf,MAAM,SAAS,CAAC","sourcesContent":["/*\n * @Author : 尚博信_王强 wangqiang03@sunboxsoft.com\n * @Date : 2025-11-13 14:03:56\n * @LastEditors : 尚博信_王强 wangqiang03@sunboxsoft.com\n * @LastEditTime : 2025-11-13 14:30:00\n * @FilePath : /expo-gaode-map/src/ExpoGaodeMap.types.ts\n * @Description : 高德地图 Expo Module 主类型定义文件\n * \n * Copyright (c) 2025 by 尚博信_王强, All Rights Reserved. \n */\n\n// 导出所有类型定义\nexport * from './types';\n\n// 重新导出常用类型,方便直接从主模块导入\nexport type {\n // 通用类型\n LatLng,\n Point,\n CameraPosition,\n LatLngBounds,\n MapPoi,\n \n // 地图视图\n MapViewProps,\n CameraEvent,\n \n // 定位\n Coordinates,\n ReGeocode,\n LocationOptions,\n \n // 覆盖物\n MarkerProps,\n PolylineProps,\n PolygonProps,\n CircleProps,\n HeatMapProps,\n MultiPointProps,\n ClusterProps,\n} from './types';\n\nexport {\n MapType,\n LocationMode,\n LocationAccuracy,\n CoordinateType,\n} from './types';\n\n/**\n * Expo 模块事件类型\n */\nexport type ExpoGaodeMapModuleEvents = {\n /**\n * 定位更新事件\n */\n onLocationUpdate: (location: any) => void;\n \n /**\n * 定位错误事件\n */\n onLocationError: (error: { code: number; message: string }) => void;\n};\n\n/**\n * Expo 地图视图属性(用于主视图组件)\n */\nexport type { MapViewProps as ExpoGaodeMapViewProps } from './types';\n"]}
@@ -0,0 +1,7 @@
1
+ import { NativeModule } from 'expo';
2
+ import type { ExpoGaodeMapModuleEvents } from './ExpoGaodeMap.types';
3
+ declare class ExpoGaodeMapModule extends NativeModule<ExpoGaodeMapModuleEvents> {
4
+ }
5
+ declare const _default: ExpoGaodeMapModule;
6
+ export default _default;
7
+ //# sourceMappingURL=ExpoGaodeMapModule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoGaodeMapModule.d.ts","sourceRoot":"","sources":["../src/ExpoGaodeMapModule.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,YAAY,EAAuB,MAAM,MAAM,CAAC;AACzD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAGrE,OAAO,OAAO,kBAAmB,SAAQ,YAAY,CAAC,wBAAwB,CAAC;CAG9E;;AAGD,wBAAuE"}
@@ -0,0 +1,14 @@
1
+ /*
2
+ * @Author : 尚博信_王强 wangqiang03@sunboxsoft.com
3
+ * @Date : 2025-11-13 14:03:56
4
+ * @LastEditors : 尚博信_王强 wangqiang03@sunboxsoft.com
5
+ * @LastEditTime : 2025-11-13 14:58:00
6
+ * @FilePath : /expo-gaode-map/src/ExpoGaodeMapModule.ts
7
+ * @Description :
8
+ *
9
+ * Copyright (c) 2025 by 尚博信_王强, All Rights Reserved.
10
+ */
11
+ import { requireNativeModule } from 'expo';
12
+ // This call loads the native module object from the JSI.
13
+ export default requireNativeModule('ExpoGaodeMap');
14
+ //# sourceMappingURL=ExpoGaodeMapModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoGaodeMapModule.js","sourceRoot":"","sources":["../src/ExpoGaodeMapModule.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAgB,mBAAmB,EAAE,MAAM,MAAM,CAAC;AASzD,yDAAyD;AACzD,eAAe,mBAAmB,CAAqB,cAAc,CAAC,CAAC","sourcesContent":["/*\n * @Author : 尚博信_王强 wangqiang03@sunboxsoft.com\n * @Date : 2025-11-13 14:03:56\n * @LastEditors : 尚博信_王强 wangqiang03@sunboxsoft.com\n * @LastEditTime : 2025-11-13 14:58:00\n * @FilePath : /expo-gaode-map/src/ExpoGaodeMapModule.ts\n * @Description : \n * \n * Copyright (c) 2025 by 尚博信_王强, All Rights Reserved. \n */\nimport { NativeModule, requireNativeModule } from 'expo';\nimport type { ExpoGaodeMapModuleEvents } from './ExpoGaodeMap.types';\n\n\ndeclare class ExpoGaodeMapModule extends NativeModule<ExpoGaodeMapModuleEvents> {\n // 地图控制方法已移至 MapView 的 ref 调用\n // 使用方式: mapRef.current.moveCamera() 等\n}\n\n// This call loads the native module object from the JSI.\nexport default requireNativeModule<ExpoGaodeMapModule>('ExpoGaodeMap');\n"]}
@@ -0,0 +1,31 @@
1
+ import * as React from 'react';
2
+ import type { MapViewProps, MapViewRef } from './types';
3
+ export type { MapViewRef } from './types';
4
+ export declare const MapContext: React.Context<React.RefObject<MapViewRef | null> | null>;
5
+ /**
6
+ * 高德地图视图组件
7
+ *
8
+ * @example
9
+ * ```tsx
10
+ * import { MapView } from 'expo-gaode-map';
11
+ *
12
+ * function MyMap() {
13
+ * const mapRef = React.useRef(null);
14
+ *
15
+ * return (
16
+ * <MapView
17
+ * ref={mapRef}
18
+ * style={{ flex: 1 }}
19
+ * initialCameraPosition={{
20
+ * target: { latitude: 39.9, longitude: 116.4 },
21
+ * zoom: 10,
22
+ * }}
23
+ * onLoad={() => console.log('地图加载完成')}
24
+ * />
25
+ * );
26
+ * }
27
+ * ```
28
+ */
29
+ declare const ExpoGaodeMapView: React.ForwardRefExoticComponent<MapViewProps & React.RefAttributes<MapViewRef>>;
30
+ export default ExpoGaodeMapView;
31
+ //# sourceMappingURL=ExpoGaodeMapView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoGaodeMapView.d.ts","sourceRoot":"","sources":["../src/ExpoGaodeMapView.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EASX,MAAM,SAAS,CAAC;AAGjB,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAK1C,eAAO,MAAM,UAAU,0DAAuE,CAAC;AAE/F;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,QAAA,MAAM,gBAAgB,iFAuFpB,CAAC;AAIH,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,141 @@
1
+ /*
2
+ * @Author : 尚博信_王强 wangqiang03@sunboxsoft.com
3
+ * @Date : 2025-11-13 14:03:56
4
+ * @LastEditors : 尚博信_王强 wangqiang03@sunboxsoft.com
5
+ * @LastEditTime : 2025-11-13 19:35:20
6
+ * @FilePath : /expo-gaode-map/src/ExpoGaodeMapView.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 NativeView = requireNativeViewManager('ExpoGaodeMap');
14
+ // 创建 Context 用于子组件访问 MapRef
15
+ export const MapContext = React.createContext(null);
16
+ /**
17
+ * 高德地图视图组件
18
+ *
19
+ * @example
20
+ * ```tsx
21
+ * import { MapView } from 'expo-gaode-map';
22
+ *
23
+ * function MyMap() {
24
+ * const mapRef = React.useRef(null);
25
+ *
26
+ * return (
27
+ * <MapView
28
+ * ref={mapRef}
29
+ * style={{ flex: 1 }}
30
+ * initialCameraPosition={{
31
+ * target: { latitude: 39.9, longitude: 116.4 },
32
+ * zoom: 10,
33
+ * }}
34
+ * onLoad={() => console.log('地图加载完成')}
35
+ * />
36
+ * );
37
+ * }
38
+ * ```
39
+ */
40
+ const ExpoGaodeMapView = React.forwardRef((props, ref) => {
41
+ const nativeRef = React.useRef(null);
42
+ const internalRef = React.useRef(null);
43
+ const apiRef = React.useMemo(() => ({
44
+ moveCamera: async (position, duration = 0) => {
45
+ if (!nativeRef.current)
46
+ throw new Error('MapView not initialized');
47
+ return nativeRef.current.moveCamera(position, duration);
48
+ },
49
+ getLatLng: async (point) => {
50
+ if (!nativeRef.current)
51
+ throw new Error('MapView not initialized');
52
+ return nativeRef.current.getLatLng(point);
53
+ },
54
+ setCenter: async (center, animated = false) => {
55
+ if (!nativeRef.current)
56
+ throw new Error('MapView not initialized');
57
+ return nativeRef.current.setCenter(center, animated);
58
+ },
59
+ setZoom: async (zoom, animated = false) => {
60
+ if (!nativeRef.current)
61
+ throw new Error('MapView not initialized');
62
+ return nativeRef.current.setZoom(zoom, animated);
63
+ },
64
+ getCameraPosition: async () => {
65
+ if (!nativeRef.current)
66
+ throw new Error('MapView not initialized');
67
+ return nativeRef.current.getCameraPosition();
68
+ },
69
+ addCircle: async (id, props) => {
70
+ if (!nativeRef.current)
71
+ throw new Error('MapView not initialized');
72
+ return nativeRef.current.addCircle(id, props);
73
+ },
74
+ removeCircle: async (id) => {
75
+ if (!nativeRef.current)
76
+ throw new Error('MapView not initialized');
77
+ return nativeRef.current.removeCircle(id);
78
+ },
79
+ updateCircle: async (id, props) => {
80
+ if (!nativeRef.current)
81
+ throw new Error('MapView not initialized');
82
+ return nativeRef.current.updateCircle(id, props);
83
+ },
84
+ addMarker: async (id, props) => {
85
+ if (!nativeRef.current)
86
+ throw new Error('MapView not initialized');
87
+ return nativeRef.current.addMarker(id, props);
88
+ },
89
+ removeMarker: async (id) => {
90
+ if (!nativeRef.current)
91
+ throw new Error('MapView not initialized');
92
+ return nativeRef.current.removeMarker(id);
93
+ },
94
+ updateMarker: async (id, props) => {
95
+ if (!nativeRef.current)
96
+ throw new Error('MapView not initialized');
97
+ return nativeRef.current.updateMarker(id, props);
98
+ },
99
+ addPolyline: async (id, props) => {
100
+ if (!nativeRef.current)
101
+ throw new Error('MapView not initialized');
102
+ return nativeRef.current.addPolyline(id, props);
103
+ },
104
+ removePolyline: async (id) => {
105
+ if (!nativeRef.current)
106
+ throw new Error('MapView not initialized');
107
+ return nativeRef.current.removePolyline(id);
108
+ },
109
+ updatePolyline: async (id, props) => {
110
+ if (!nativeRef.current)
111
+ throw new Error('MapView not initialized');
112
+ return nativeRef.current.updatePolyline(id, props);
113
+ },
114
+ addPolygon: async (id, props) => {
115
+ if (!nativeRef.current)
116
+ throw new Error('MapView not initialized');
117
+ return nativeRef.current.addPolygon(id, props);
118
+ },
119
+ removePolygon: async (id) => {
120
+ if (!nativeRef.current)
121
+ throw new Error('MapView not initialized');
122
+ return nativeRef.current.removePolygon(id);
123
+ },
124
+ updatePolygon: async (id, props) => {
125
+ if (!nativeRef.current)
126
+ throw new Error('MapView not initialized');
127
+ return nativeRef.current.updatePolygon(id, props);
128
+ },
129
+ }), []);
130
+ // 设置 internalRef 和外部 ref
131
+ React.useEffect(() => {
132
+ internalRef.current = apiRef;
133
+ }, [apiRef]);
134
+ React.useImperativeHandle(ref, () => apiRef, [apiRef]);
135
+ return (<MapContext.Provider value={internalRef}>
136
+ <NativeView ref={nativeRef} {...props}/>
137
+ </MapContext.Provider>);
138
+ });
139
+ ExpoGaodeMapView.displayName = 'ExpoGaodeMapView';
140
+ export default ExpoGaodeMapView;
141
+ //# sourceMappingURL=ExpoGaodeMapView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoGaodeMapView.js","sourceRoot":"","sources":["../src/ExpoGaodeMapView.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAkB/B,MAAM,UAAU,GAA8E,wBAAwB,CAAC,cAAc,CAAC,CAAC;AAEvI,4BAA4B;AAC5B,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,CAAC,aAAa,CAA4C,IAAI,CAAC,CAAC;AAE/F;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,gBAAgB,GAAG,KAAK,CAAC,UAAU,CAA2B,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACjF,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAmB,IAAI,CAAC,CAAC;IACvD,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAoB,IAAI,CAAC,CAAC;IAE1D,MAAM,MAAM,GAAe,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAC9C,UAAU,EAAE,KAAK,EAAE,QAAwB,EAAE,WAAmB,CAAC,EAAE,EAAE;YACnE,IAAI,CAAC,SAAS,CAAC,OAAO;gBAAE,MAAM,IAAI,K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CAAC;YACnE,OAAO,SAAS,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QACpD,CAAC;KACF,CAAC,EAAE,EAAE,CAAC,CAAC;IAER,yBAAyB;IACzB,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,WAAW,CAAC,OAAO,GAAG,MAAM,CAAC;IAC/B,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,KAAK,CAAC,mBAAmB,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEvD,OAAO,CACL,CAAC,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,CACtC;MAAA,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,IAAI,KAAK,CAAC,EACxC;IAAA,EAAE,UAAU,CAAC,QAAQ,CAAC,CACvB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,gBAAgB,CAAC,WAAW,GAAG,kBAAkB,CAAC;AAElD,eAAe,gBAAgB,CAAC","sourcesContent":["/*\n * @Author : 尚博信_王强 wangqiang03@sunboxsoft.com\n * @Date : 2025-11-13 14:03:56\n * @LastEditors : 尚博信_王强 wangqiang03@sunboxsoft.com\n * @LastEditTime : 2025-11-13 19:35:20\n * @FilePath : /expo-gaode-map/src/ExpoGaodeMapView.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';\n\nimport type { \n MapViewProps, \n MapViewRef,\n NativeMapViewRef,\n CameraPosition, \n LatLng, \n Point, \n CircleProps,\n MarkerProps,\n PolylineProps,\n PolygonProps,\n} from './types';\n\n// 重新导出 MapViewRef 供外部使用\nexport type { MapViewRef } from './types';\n\nconst NativeView: React.ComponentType<MapViewProps & { ref?: React.Ref<NativeMapViewRef> }> = requireNativeViewManager('ExpoGaodeMap');\n\n// 创建 Context 用于子组件访问 MapRef\nexport const MapContext = React.createContext<React.RefObject<MapViewRef | null> | null>(null);\n\n/**\n * 高德地图视图组件\n * \n * @example\n * ```tsx\n * import { MapView } from 'expo-gaode-map';\n * \n * function MyMap() {\n * const mapRef = React.useRef(null);\n * \n * return (\n * <MapView\n * ref={mapRef}\n * style={{ flex: 1 }}\n * initialCameraPosition={{\n * target: { latitude: 39.9, longitude: 116.4 },\n * zoom: 10,\n * }}\n * onLoad={() => console.log('地图加载完成')}\n * />\n * );\n * }\n * ```\n */\nconst ExpoGaodeMapView = React.forwardRef<MapViewRef, MapViewProps>((props, ref) => {\n const nativeRef = React.useRef<NativeMapViewRef>(null);\n const internalRef = React.useRef<MapViewRef | null>(null);\n\n const apiRef: MapViewRef = React.useMemo(() => ({\n moveCamera: async (position: CameraPosition, duration: number = 0) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.moveCamera(position, duration);\n },\n getLatLng: async (point: Point) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.getLatLng(point);\n },\n setCenter: async (center: LatLng, animated: boolean = false) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.setCenter(center, animated);\n },\n setZoom: async (zoom: number, animated: boolean = false) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.setZoom(zoom, animated);\n },\n getCameraPosition: async () => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.getCameraPosition();\n },\n addCircle: async (id: string, props: CircleProps) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.addCircle(id, props);\n },\n removeCircle: async (id: string) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.removeCircle(id);\n },\n updateCircle: async (id: string, props: Partial<CircleProps>) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.updateCircle(id, props);\n },\n addMarker: async (id: string, props: MarkerProps) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.addMarker(id, props);\n },\n removeMarker: async (id: string) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.removeMarker(id);\n },\n updateMarker: async (id: string, props: Partial<MarkerProps>) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.updateMarker(id, props);\n },\n addPolyline: async (id: string, props: PolylineProps) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.addPolyline(id, props);\n },\n removePolyline: async (id: string) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.removePolyline(id);\n },\n updatePolyline: async (id: string, props: Partial<PolylineProps>) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.updatePolyline(id, props);\n },\n addPolygon: async (id: string, props: PolygonProps) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.addPolygon(id, props);\n },\n removePolygon: async (id: string) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.removePolygon(id);\n },\n updatePolygon: async (id: string, props: Partial<PolygonProps>) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.updatePolygon(id, props);\n },\n }), []);\n\n // 设置 internalRef 和外部 ref\n React.useEffect(() => {\n internalRef.current = apiRef;\n }, [apiRef]);\n\n React.useImperativeHandle(ref, () => apiRef, [apiRef]);\n\n return (\n <MapContext.Provider value={internalRef}>\n <NativeView ref={nativeRef} {...props} />\n </MapContext.Provider>\n );\n});\n\nExpoGaodeMapView.displayName = 'ExpoGaodeMapView';\n\nexport default ExpoGaodeMapView;\n"]}
@@ -0,0 +1,18 @@
1
+ import type { CircleProps } from '../../types';
2
+ /**
3
+ * 地图圆形组件
4
+ *
5
+ * @example
6
+ * ```tsx
7
+ * <MapView>
8
+ * <Circle
9
+ * center={{ latitude: 39.9, longitude: 116.4 }}
10
+ * radius={1000}
11
+ * fillColor={0x440000FF}
12
+ * strokeColor={0xFFFF0000}
13
+ * />
14
+ * </MapView>
15
+ * ```
16
+ */
17
+ export default function Circle(props: CircleProps): null;
18
+ //# sourceMappingURL=Circle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Circle.d.ts","sourceRoot":"","sources":["../../../src/components/overlays/Circle.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,WAAW,QA0ChD"}