expo-gaode-map 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/java/expo/modules/gaodemap/ExpoGaodeMapView.kt +44 -3
- package/android/src/main/java/expo/modules/gaodemap/ExpoGaodeMapViewModule.kt +1 -1
- package/android/src/main/java/expo/modules/gaodemap/managers/UIManager.kt +4 -3
- package/android/src/main/java/expo/modules/gaodemap/overlays/MarkerView.kt +47 -26
- package/build/types/map-view.types.d.ts +18 -1
- package/build/types/map-view.types.d.ts.map +1 -1
- package/build/types/map-view.types.js.map +1 -1
- package/package.json +1 -1
- package/src/types/map-view.types.ts +22 -2
|
@@ -289,7 +289,11 @@ class ExpoGaodeMapView(context: Context, appContext: AppContext) : ExpoView(cont
|
|
|
289
289
|
fun setMinZoom(minZoom: Float) = cameraManager.setMinZoomLevel(minZoom)
|
|
290
290
|
|
|
291
291
|
/** 设置是否显示用户位置 */
|
|
292
|
-
fun setShowsUserLocation(show: Boolean)
|
|
292
|
+
fun setShowsUserLocation(show: Boolean) {
|
|
293
|
+
mainHandler.post {
|
|
294
|
+
uiManager.setShowsUserLocation(show, followUserLocation)
|
|
295
|
+
}
|
|
296
|
+
}
|
|
293
297
|
|
|
294
298
|
/**
|
|
295
299
|
* 设置是否跟随用户位置
|
|
@@ -298,7 +302,11 @@ class ExpoGaodeMapView(context: Context, appContext: AppContext) : ExpoView(cont
|
|
|
298
302
|
fun setFollowUserLocation(follow: Boolean) {
|
|
299
303
|
followUserLocation = follow
|
|
300
304
|
// 如果定位已开启,立即应用新设置
|
|
301
|
-
|
|
305
|
+
mainHandler.post {
|
|
306
|
+
if (aMap.isMyLocationEnabled) {
|
|
307
|
+
uiManager.setShowsUserLocation(true, follow)
|
|
308
|
+
}
|
|
309
|
+
}
|
|
302
310
|
}
|
|
303
311
|
|
|
304
312
|
/**
|
|
@@ -476,6 +484,9 @@ class ExpoGaodeMapView(context: Context, appContext: AppContext) : ExpoView(cont
|
|
|
476
484
|
// 清理覆盖物
|
|
477
485
|
overlayManager.clear()
|
|
478
486
|
|
|
487
|
+
// 清理 MarkerView 列表
|
|
488
|
+
markerViews.clear()
|
|
489
|
+
|
|
479
490
|
// 销毁地图
|
|
480
491
|
mapView.onDestroy()
|
|
481
492
|
}
|
|
@@ -486,13 +497,19 @@ class ExpoGaodeMapView(context: Context, appContext: AppContext) : ExpoView(cont
|
|
|
486
497
|
mapView.onSaveInstanceState(outState)
|
|
487
498
|
}
|
|
488
499
|
|
|
500
|
+
/**
|
|
501
|
+
* 存储 MarkerView 引用,因为它们不在视图层级中
|
|
502
|
+
*/
|
|
503
|
+
private val markerViews = mutableListOf<MarkerView>()
|
|
504
|
+
|
|
489
505
|
/**
|
|
490
506
|
* 添加子视图时自动连接到地图
|
|
491
507
|
*/
|
|
492
508
|
override fun addView(child: View?, index: Int) {
|
|
493
509
|
if (child is MarkerView) {
|
|
494
|
-
// 不添加到视图层级,只调用 setMap
|
|
510
|
+
// 不添加到视图层级,只调用 setMap 并保存引用
|
|
495
511
|
child.setMap(aMap)
|
|
512
|
+
markerViews.add(child)
|
|
496
513
|
return
|
|
497
514
|
}
|
|
498
515
|
|
|
@@ -511,6 +528,30 @@ class ExpoGaodeMapView(context: Context, appContext: AppContext) : ExpoView(cont
|
|
|
511
528
|
}
|
|
512
529
|
}
|
|
513
530
|
|
|
531
|
+
/**
|
|
532
|
+
* 移除子视图
|
|
533
|
+
*/
|
|
534
|
+
override fun removeView(child: View?) {
|
|
535
|
+
if (child is MarkerView) {
|
|
536
|
+
// 从 MarkerView 列表中移除
|
|
537
|
+
markerViews.remove(child)
|
|
538
|
+
return
|
|
539
|
+
}
|
|
540
|
+
super.removeView(child)
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
/**
|
|
544
|
+
* 按索引移除视图
|
|
545
|
+
*/
|
|
546
|
+
override fun removeViewAt(index: Int) {
|
|
547
|
+
// 检查是否在尝试移除不存在的索引
|
|
548
|
+
if (index >= 0 && index < childCount) {
|
|
549
|
+
super.removeViewAt(index)
|
|
550
|
+
} else {
|
|
551
|
+
Log.w(TAG, "尝试移除无效的视图索引: $index, 当前子视图数: $childCount")
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
|
|
514
555
|
private fun checkDeclarativePolylinePress(latLng: LatLng): Boolean {
|
|
515
556
|
for (i in 0 until childCount) {
|
|
516
557
|
val child = getChildAt(i)
|
|
@@ -35,8 +35,8 @@ class ExpoGaodeMapViewModule : Module() {
|
|
|
35
35
|
Prop<Float>("maxZoom") { view, maxZoom -> view.setMaxZoom(maxZoom) }
|
|
36
36
|
Prop<Float>("minZoom") { view, minZoom -> view.setMinZoom(minZoom) }
|
|
37
37
|
|
|
38
|
-
Prop<Boolean>("myLocationEnabled") { view, show -> view.setShowsUserLocation(show) }
|
|
39
38
|
Prop<Boolean>("followUserLocation") { view, follow -> view.setFollowUserLocation(follow) }
|
|
39
|
+
Prop<Boolean>("myLocationEnabled") { view, show -> view.setShowsUserLocation(show) }
|
|
40
40
|
Prop<Map<String, Any>?>("userLocationRepresentation") { view, representation ->
|
|
41
41
|
representation?.let { view.setUserLocationRepresentation(it) }
|
|
42
42
|
}
|
|
@@ -96,24 +96,25 @@ class UIManager(private val aMap: AMap, private val context: Context) : Location
|
|
|
96
96
|
val locationType = if (followUserLocation) {
|
|
97
97
|
MyLocationStyle.LOCATION_TYPE_FOLLOW // 连续定位并跟随
|
|
98
98
|
} else {
|
|
99
|
-
MyLocationStyle.
|
|
99
|
+
MyLocationStyle.LOCATION_TYPE_SHOW // 只显示定位点,不跟随
|
|
100
100
|
}
|
|
101
101
|
myLocationType(locationType)
|
|
102
102
|
interval(2000) // 2秒定位一次
|
|
103
103
|
showMyLocation(true)
|
|
104
104
|
}
|
|
105
|
-
android.util.Log.d("UIManager", "✨ 创建默认 MyLocationStyle")
|
|
105
|
+
android.util.Log.d("UIManager", "✨ 创建默认 MyLocationStyle,类型: ${if (followUserLocation) "FOLLOW" else "SHOW"}")
|
|
106
106
|
} else {
|
|
107
107
|
// 更新定位类型
|
|
108
108
|
val locationType = if (followUserLocation) {
|
|
109
109
|
MyLocationStyle.LOCATION_TYPE_FOLLOW
|
|
110
110
|
} else {
|
|
111
|
-
MyLocationStyle.
|
|
111
|
+
MyLocationStyle.LOCATION_TYPE_SHOW
|
|
112
112
|
}
|
|
113
113
|
currentLocationStyle?.apply {
|
|
114
114
|
myLocationType(locationType)
|
|
115
115
|
interval(2000)
|
|
116
116
|
}
|
|
117
|
+
android.util.Log.d("UIManager", "🔄 更新定位类型: ${if (followUserLocation) "FOLLOW" else "SHOW"}")
|
|
117
118
|
}
|
|
118
119
|
|
|
119
120
|
// 监听定位变化(用于通知 React Native)
|
|
@@ -547,38 +547,54 @@ class MarkerView(context: Context, appContext: AppContext) : ExpoView(context, a
|
|
|
547
547
|
|
|
548
548
|
override fun removeView(child: View?) {
|
|
549
549
|
android.util.Log.d("MarkerView", "➖ removeView 被调用,child = $child, childCount = $childCount")
|
|
550
|
-
super.removeView(child)
|
|
551
550
|
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
551
|
+
try {
|
|
552
|
+
// 检查子视图是否确实存在
|
|
553
|
+
if (child != null && indexOfChild(child) >= 0) {
|
|
554
|
+
super.removeView(child)
|
|
555
|
+
|
|
556
|
+
// 子视图被移除后,清除图标或恢复默认图标
|
|
557
|
+
mainHandler.postDelayed({
|
|
558
|
+
android.util.Log.d("MarkerView", "⏰ removeView 延迟更新,childCount = $childCount")
|
|
559
|
+
if (childCount == 0 && marker != null) {
|
|
560
|
+
android.util.Log.d("MarkerView", "📍 所有子视图已移除,恢复默认图标")
|
|
561
|
+
marker?.setIcon(BitmapDescriptorFactory.defaultMarker())
|
|
562
|
+
marker?.setAnchor(0.5f, 1.0f)
|
|
563
|
+
}
|
|
564
|
+
}, 50)
|
|
565
|
+
} else {
|
|
566
|
+
android.util.Log.w("MarkerView", "⚠️ removeView: 子视图不存在或不属于此ViewGroup")
|
|
559
567
|
}
|
|
560
|
-
}
|
|
568
|
+
} catch (e: Exception) {
|
|
569
|
+
android.util.Log.e("MarkerView", "❌ removeView 发生异常", e)
|
|
570
|
+
}
|
|
561
571
|
}
|
|
562
572
|
|
|
563
573
|
override fun removeViewAt(index: Int) {
|
|
564
574
|
android.util.Log.d("MarkerView", "➖ removeViewAt 被调用,index = $index, childCount = $childCount")
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
575
|
+
|
|
576
|
+
try {
|
|
577
|
+
// 确保索引在有效范围内
|
|
578
|
+
if (index >= 0 && index < childCount) {
|
|
579
|
+
super.removeViewAt(index)
|
|
580
|
+
|
|
581
|
+
// 子视图被移除后,清除图标或恢复默认图标
|
|
582
|
+
mainHandler.postDelayed({
|
|
583
|
+
android.util.Log.d("MarkerView", "⏰ removeViewAt 延迟更新,childCount = $childCount")
|
|
584
|
+
if (childCount == 0 && marker != null) {
|
|
585
|
+
android.util.Log.d("MarkerView", "📍 所有子视图已移除,恢复默认图标")
|
|
586
|
+
marker?.setIcon(BitmapDescriptorFactory.defaultMarker())
|
|
587
|
+
marker?.setAnchor(0.5f, 1.0f)
|
|
588
|
+
} else if (childCount > 0 && marker != null) {
|
|
589
|
+
android.util.Log.d("MarkerView", "🔄 还有子视图,更新图标")
|
|
590
|
+
updateMarkerIcon()
|
|
591
|
+
}
|
|
592
|
+
}, 50)
|
|
593
|
+
} else {
|
|
594
|
+
android.util.Log.w("MarkerView", "⚠️ removeViewAt: 无效的索引 $index,childCount = $childCount,忽略此次移除操作")
|
|
595
|
+
}
|
|
596
|
+
} catch (e: Exception) {
|
|
597
|
+
android.util.Log.e("MarkerView", "❌ removeViewAt 发生异常: index=$index, childCount=$childCount", e)
|
|
582
598
|
}
|
|
583
599
|
}
|
|
584
600
|
|
|
@@ -635,6 +651,11 @@ class MarkerView(context: Context, appContext: AppContext) : ExpoView(context, a
|
|
|
635
651
|
|
|
636
652
|
override fun onDetachedFromWindow() {
|
|
637
653
|
super.onDetachedFromWindow()
|
|
654
|
+
|
|
655
|
+
// 清理所有延迟任务
|
|
656
|
+
mainHandler.removeCallbacksAndMessages(null)
|
|
657
|
+
|
|
658
|
+
// 移除 marker
|
|
638
659
|
removeMarker()
|
|
639
660
|
}
|
|
640
661
|
}
|
|
@@ -4,6 +4,23 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { StyleProp, ViewStyle, NativeSyntheticEvent } from 'react-native';
|
|
6
6
|
import type { CameraPosition, LatLng, LatLngBounds, MapPoi, MapType, Point } from './common.types';
|
|
7
|
+
/**
|
|
8
|
+
* 定位事件数据
|
|
9
|
+
*/
|
|
10
|
+
export interface LocationEvent {
|
|
11
|
+
/**
|
|
12
|
+
* 纬度
|
|
13
|
+
*/
|
|
14
|
+
latitude: number;
|
|
15
|
+
/**
|
|
16
|
+
* 经度
|
|
17
|
+
*/
|
|
18
|
+
longitude: number;
|
|
19
|
+
/**
|
|
20
|
+
* 定位精度(米)
|
|
21
|
+
*/
|
|
22
|
+
accuracy: number;
|
|
23
|
+
}
|
|
7
24
|
/**
|
|
8
25
|
* 地图相机事件
|
|
9
26
|
*/
|
|
@@ -165,7 +182,7 @@ export interface MapViewProps {
|
|
|
165
182
|
/**
|
|
166
183
|
* 地图定位更新事件
|
|
167
184
|
*/
|
|
168
|
-
onLocation?: (event: NativeSyntheticEvent<
|
|
185
|
+
onLocation?: (event: NativeSyntheticEvent<LocationEvent>) => void;
|
|
169
186
|
/**
|
|
170
187
|
* Marker 点击事件
|
|
171
188
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map-view.types.d.ts","sourceRoot":"","sources":["../../src/types/map-view.types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"map-view.types.d.ts","sourceRoot":"","sources":["../../src/types/map-view.types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAC/E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEnG;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB;AAGD;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,cAAc,EAAE,cAAc,CAAC;IAE/B;;OAEG;IACH,YAAY,EAAE,YAAY,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,qBAAqB,CAAC,EAAE,cAAc,CAAC;IAEvC;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B;;OAEG;IACH,0BAA0B,CAAC,EAAE;QAC3B,4BAA4B;QAC5B,iBAAiB,CAAC,EAAE,OAAO,CAAC;QAC5B,2CAA2C;QAC3C,qBAAqB,CAAC,EAAE,OAAO,CAAC;QAChC,2CAA2C;QAC3C,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QAC5B,cAAc;QACd,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QAC9B,yBAAyB;QAC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EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,kBAAkB,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxF,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,OAAO,kBAAkB,EAAE,aAAa,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpG,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,kBAAkB,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtF,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,OAAO,kBAAkB,EAAE,YAAY,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map-view.types.js","sourceRoot":"","sources":["../../src/types/map-view.types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * 高德地图视图相关类型定义\n * 基于 Expo Modules API\n */\n\nimport type { StyleProp, ViewStyle,NativeSyntheticEvent } from 'react-native';\nimport type { CameraPosition, LatLng, LatLngBounds, MapPoi, MapType, Point } from './common.types';\n\n\n/**\n * 地图相机事件\n */\nexport interface CameraEvent {\n /**\n * 相机位置\n */\n cameraPosition: CameraPosition;\n\n /**\n * 可见区域边界\n */\n latLngBounds: LatLngBounds;\n}\n\n/**\n * 地图视图属性\n */\nexport interface MapViewProps {\n /**\n * 地图类型\n */\n mapType?: MapType;\n\n /**\n * 初始相机位置\n */\n initialCameraPosition?: CameraPosition;\n\n /**\n * 是否显示当前定位\n */\n myLocationEnabled?: boolean;\n\n /**\n * 是否跟随用户位置\n * @default false\n */\n followUserLocation?: boolean;\n\n /**\n * 定位蓝点配置\n */\n userLocationRepresentation?: {\n /** 精度圈是否显示 @default true */\n showsAccuracyRing?: boolean;\n /** 是否显示方向指示 @default true @platform ios */\n showsHeadingIndicator?: boolean;\n /** 精度圈填充颜色 支持 '#RRGGBB'、'red' 或 ARGB 数字 */\n fillColor?: string | number;\n /** 精度圈边线颜色 */\n strokeColor?: string | number;\n /** 精度圈边线宽度 @default 0 */\n lineWidth?: number;\n /** 内部蓝色圆点是否使用律动效果 @default true @platform ios */\n enablePulseAnimation?: boolean;\n /** 定位点背景色 @default 'white' @platform ios */\n locationDotBgColor?: string | number;\n /** 定位点蓝色圆点颜色 @default 'blue' @platform ios */\n locationDotFillColor?: string | number;\n /** 定位图标 支持网络图片(http/https)、本地文件(file://)或资源名称 */\n image?: string;\n /** 定位图标宽度(像素) */\n imageWidth?: number;\n /** 定位图标高度(像素) */\n imageHeight?: number;\n };\n\n /**\n * 是否显示室内地图\n * \n */\n indoorViewEnabled?: boolean;\n\n /**\n * 是否显示3D建筑\n */\n buildingsEnabled?: boolean;\n\n /**\n * 是否显示标注\n */\n labelsEnabled?: boolean;\n\n /**\n * 是否显示指南针\n */\n compassEnabled?: boolean;\n\n /**\n * 是否显示缩放按钮\n * @platform android\n */\n zoomControlsEnabled?: boolean;\n\n /**\n * 是否显示比例尺\n */\n scaleControlsEnabled?: boolean;\n\n /**\n * 是否显示定位按钮\n * @platform android\n */\n myLocationButtonEnabled?: boolean;\n\n /**\n * 是否显示路况\n */\n trafficEnabled?: boolean;\n\n /**\n * 最大缩放级别\n */\n maxZoom?: number;\n\n /**\n * 最小缩放级别\n */\n minZoom?: number;\n\n /**\n * 是否启用缩放手势\n */\n zoomGesturesEnabled?: boolean;\n\n /**\n * 是否启用滑动手势\n */\n scrollGesturesEnabled?: boolean;\n\n /**\n * 是否启用旋转手势\n */\n rotateGesturesEnabled?: boolean;\n\n /**\n * 是否启用倾斜手势\n */\n tiltGesturesEnabled?: boolean;\n\n /**\n * 定位的最小更新距离(米)\n * @platform ios\n */\n distanceFilter?: number;\n\n /**\n * 最小更新角度(度)\n * @platform ios\n */\n headingFilter?: number;\n\n /**\n * 样式\n */\n style?: StyleProp<ViewStyle>;\n\n /**\n * 点击地图事件\n */\n onMapPress?: (event: NativeSyntheticEvent<LatLng>) => void;\n\n /**\n * 点击标注点事件\n */\n onPressPoi?: (event: NativeSyntheticEvent<MapPoi>) => void;\n\n /**\n * 长按地图事件\n */\n onMapLongPress?: (event: NativeSyntheticEvent<LatLng>) => void;\n\n /**\n * 地图状态改变事件(实时触发)\n */\n onCameraMove?: (event: NativeSyntheticEvent<CameraEvent>) => void;\n\n /**\n * 地图状态改变完成事件\n */\n onCameraIdle?: (event: NativeSyntheticEvent<CameraEvent>) => void;\n\n /**\n * 地图加载完成事件\n */\n onLoad?: (event: NativeSyntheticEvent<{}>) => void;\n\n /**\n * 地图定位更新事件\n */\n onLocation?: (event: NativeSyntheticEvent<
|
|
1
|
+
{"version":3,"file":"map-view.types.js","sourceRoot":"","sources":["../../src/types/map-view.types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * 高德地图视图相关类型定义\n * 基于 Expo Modules API\n */\n\nimport type { StyleProp, ViewStyle, NativeSyntheticEvent } from 'react-native';\nimport type { CameraPosition, LatLng, LatLngBounds, MapPoi, MapType, Point } from './common.types';\n\n/**\n * 定位事件数据\n */\nexport interface LocationEvent {\n /**\n * 纬度\n */\n latitude: number;\n \n /**\n * 经度\n */\n longitude: number;\n \n /**\n * 定位精度(米)\n */\n accuracy: number;\n}\n\n\n/**\n * 地图相机事件\n */\nexport interface CameraEvent {\n /**\n * 相机位置\n */\n cameraPosition: CameraPosition;\n\n /**\n * 可见区域边界\n */\n latLngBounds: LatLngBounds;\n}\n\n/**\n * 地图视图属性\n */\nexport interface MapViewProps {\n /**\n * 地图类型\n */\n mapType?: MapType;\n\n /**\n * 初始相机位置\n */\n initialCameraPosition?: CameraPosition;\n\n /**\n * 是否显示当前定位\n */\n myLocationEnabled?: boolean;\n\n /**\n * 是否跟随用户位置\n * @default false\n */\n followUserLocation?: boolean;\n\n /**\n * 定位蓝点配置\n */\n userLocationRepresentation?: {\n /** 精度圈是否显示 @default true */\n showsAccuracyRing?: boolean;\n /** 是否显示方向指示 @default true @platform ios */\n showsHeadingIndicator?: boolean;\n /** 精度圈填充颜色 支持 '#RRGGBB'、'red' 或 ARGB 数字 */\n fillColor?: string | number;\n /** 精度圈边线颜色 */\n strokeColor?: string | number;\n /** 精度圈边线宽度 @default 0 */\n lineWidth?: number;\n /** 内部蓝色圆点是否使用律动效果 @default true @platform ios */\n enablePulseAnimation?: boolean;\n /** 定位点背景色 @default 'white' @platform ios */\n locationDotBgColor?: string | number;\n /** 定位点蓝色圆点颜色 @default 'blue' @platform ios */\n locationDotFillColor?: string | number;\n /** 定位图标 支持网络图片(http/https)、本地文件(file://)或资源名称 */\n image?: string;\n /** 定位图标宽度(像素) */\n imageWidth?: number;\n /** 定位图标高度(像素) */\n imageHeight?: number;\n };\n\n /**\n * 是否显示室内地图\n * \n */\n indoorViewEnabled?: boolean;\n\n /**\n * 是否显示3D建筑\n */\n buildingsEnabled?: boolean;\n\n /**\n * 是否显示标注\n */\n labelsEnabled?: boolean;\n\n /**\n * 是否显示指南针\n */\n compassEnabled?: boolean;\n\n /**\n * 是否显示缩放按钮\n * @platform android\n */\n zoomControlsEnabled?: boolean;\n\n /**\n * 是否显示比例尺\n */\n scaleControlsEnabled?: boolean;\n\n /**\n * 是否显示定位按钮\n * @platform android\n */\n myLocationButtonEnabled?: boolean;\n\n /**\n * 是否显示路况\n */\n trafficEnabled?: boolean;\n\n /**\n * 最大缩放级别\n */\n maxZoom?: number;\n\n /**\n * 最小缩放级别\n */\n minZoom?: number;\n\n /**\n * 是否启用缩放手势\n */\n zoomGesturesEnabled?: boolean;\n\n /**\n * 是否启用滑动手势\n */\n scrollGesturesEnabled?: boolean;\n\n /**\n * 是否启用旋转手势\n */\n rotateGesturesEnabled?: boolean;\n\n /**\n * 是否启用倾斜手势\n */\n tiltGesturesEnabled?: boolean;\n\n /**\n * 定位的最小更新距离(米)\n * @platform ios\n */\n distanceFilter?: number;\n\n /**\n * 最小更新角度(度)\n * @platform ios\n */\n headingFilter?: number;\n\n /**\n * 样式\n */\n style?: StyleProp<ViewStyle>;\n\n /**\n * 点击地图事件\n */\n onMapPress?: (event: NativeSyntheticEvent<LatLng>) => void;\n\n /**\n * 点击标注点事件\n */\n onPressPoi?: (event: NativeSyntheticEvent<MapPoi>) => void;\n\n /**\n * 长按地图事件\n */\n onMapLongPress?: (event: NativeSyntheticEvent<LatLng>) => void;\n\n /**\n * 地图状态改变事件(实时触发)\n */\n onCameraMove?: (event: NativeSyntheticEvent<CameraEvent>) => void;\n\n /**\n * 地图状态改变完成事件\n */\n onCameraIdle?: (event: NativeSyntheticEvent<CameraEvent>) => void;\n\n /**\n * 地图加载完成事件\n */\n onLoad?: (event: NativeSyntheticEvent<{}>) => void;\n\n /**\n * 地图定位更新事件\n */\n onLocation?: (event: NativeSyntheticEvent<LocationEvent>) => void;\n\n /**\n * Marker 点击事件\n */\n onMarkerPress?: (event: NativeSyntheticEvent<{ markerId: string } & LatLng>) => void;\n\n /**\n * Marker 拖拽开始事件\n */\n onMarkerDragStart?: (event: NativeSyntheticEvent<{ markerId: string } & LatLng>) => void;\n\n /**\n * Marker 拖拽中事件\n */\n onMarkerDrag?: (event: NativeSyntheticEvent<{ markerId: string } & LatLng>) => void;\n\n /**\n * Marker 拖拽结束事件\n */\n onMarkerDragEnd?: (event: NativeSyntheticEvent<{ markerId: string } & LatLng>) => void;\n\n /**\n * Circle 点击事件\n */\n onCirclePress?: (event: NativeSyntheticEvent<{ circleId: string } & LatLng>) => void;\n\n /**\n * Polygon 点击事件\n */\n onPolygonPress?: (event: NativeSyntheticEvent<{ polygonId: string } & LatLng>) => void;\n\n /**\n * Polyline 点击事件\n */\n onPolylinePress?: (event: NativeSyntheticEvent<{ polylineId: string } & LatLng>) => void;\n\n /**\n * 子组件\n */\n children?: React.ReactNode;\n}\n\n/**\n * 地图视图方法\n */\nexport interface MapViewMethods {\n /**\n * 移动相机\n * @param cameraPosition 目标相机位置\n * @param duration 动画时长(毫秒)\n */\n moveCamera(cameraPosition: CameraPosition, duration?: number): void;\n\n /**\n * 将屏幕坐标转换为地理坐标\n * @param point 屏幕坐标\n * @returns 地理坐标\n */\n getLatLng(point: Point): Promise<LatLng>;\n}\n\n/**\n * MapView Ref 公开接口(用户使用)\n */\nexport interface MapViewRef {\n moveCamera(position: CameraPosition, duration?: number): Promise<void>;\n getLatLng(point: Point): Promise<LatLng>;\n setCenter(center: LatLng, animated?: boolean): Promise<void>;\n setZoom(zoom: number, animated?: boolean): Promise<void>;\n getCameraPosition(): Promise<CameraPosition>;\n addCircle(id: string, props: import('./overlays.types').CircleProps): Promise<void>;\n removeCircle(id: string): Promise<void>;\n updateCircle(id: string, props: Partial<import('./overlays.types').CircleProps>): Promise<void>;\n addMarker(id: string, props: import('./overlays.types').MarkerProps): Promise<void>;\n removeMarker(id: string): Promise<void>;\n updateMarker(id: string, props: Partial<import('./overlays.types').MarkerProps>): Promise<void>;\n addPolyline(id: string, props: import('./overlays.types').PolylineProps): Promise<void>;\n removePolyline(id: string): Promise<void>;\n updatePolyline(id: string, props: Partial<import('./overlays.types').PolylineProps>): Promise<void>;\n addPolygon(id: string, props: import('./overlays.types').PolygonProps): Promise<void>;\n removePolygon(id: string): Promise<void>;\n updatePolygon(id: string, props: Partial<import('./overlays.types').PolygonProps>): Promise<void>;\n}\n\n/**\n * 原生 MapView Ref 接口(所有参数必需)\n */\nexport interface NativeMapViewRef {\n moveCamera(position: CameraPosition, duration: number): Promise<void>;\n getLatLng(point: Point): Promise<LatLng>;\n setCenter(center: LatLng, animated: boolean): Promise<void>;\n setZoom(zoom: number, animated: boolean): Promise<void>;\n getCameraPosition(): Promise<CameraPosition>;\n addCircle(id: string, props: import('./overlays.types').CircleProps): Promise<void>;\n removeCircle(id: string): Promise<void>;\n updateCircle(id: string, props: Partial<import('./overlays.types').CircleProps>): Promise<void>;\n addMarker(id: string, props: import('./overlays.types').MarkerProps): Promise<void>;\n removeMarker(id: string): Promise<void>;\n updateMarker(id: string, props: Partial<import('./overlays.types').MarkerProps>): Promise<void>;\n addPolyline(id: string, props: import('./overlays.types').PolylineProps): Promise<void>;\n removePolyline(id: string): Promise<void>;\n updatePolyline(id: string, props: Partial<import('./overlays.types').PolylineProps>): Promise<void>;\n addPolygon(id: string, props: import('./overlays.types').PolygonProps): Promise<void>;\n removePolygon(id: string): Promise<void>;\n updatePolygon(id: string, props: Partial<import('./overlays.types').PolygonProps>): Promise<void>;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -3,9 +3,29 @@
|
|
|
3
3
|
* 基于 Expo Modules API
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { StyleProp, ViewStyle,NativeSyntheticEvent } from 'react-native';
|
|
6
|
+
import type { StyleProp, ViewStyle, NativeSyntheticEvent } from 'react-native';
|
|
7
7
|
import type { CameraPosition, LatLng, LatLngBounds, MapPoi, MapType, Point } from './common.types';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* 定位事件数据
|
|
11
|
+
*/
|
|
12
|
+
export interface LocationEvent {
|
|
13
|
+
/**
|
|
14
|
+
* 纬度
|
|
15
|
+
*/
|
|
16
|
+
latitude: number;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 经度
|
|
20
|
+
*/
|
|
21
|
+
longitude: number;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* 定位精度(米)
|
|
25
|
+
*/
|
|
26
|
+
accuracy: number;
|
|
27
|
+
}
|
|
28
|
+
|
|
9
29
|
|
|
10
30
|
/**
|
|
11
31
|
* 地图相机事件
|
|
@@ -198,7 +218,7 @@ export interface MapViewProps {
|
|
|
198
218
|
/**
|
|
199
219
|
* 地图定位更新事件
|
|
200
220
|
*/
|
|
201
|
-
onLocation?: (event: NativeSyntheticEvent<
|
|
221
|
+
onLocation?: (event: NativeSyntheticEvent<LocationEvent>) => void;
|
|
202
222
|
|
|
203
223
|
/**
|
|
204
224
|
* Marker 点击事件
|