expo-gaode-map 2.2.8-next.1 → 2.2.8

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/README.md CHANGED
@@ -20,7 +20,7 @@
20
20
  ## ✨ 主要特性
21
21
 
22
22
  ### 核心功能(expo-gaode-map)
23
- - ✅ 完整的地图功能(多种地图类型、手势控制、相机操作)
23
+ - ✅ 完整的地图功能(多种地图类型、手势控制、相机操作,离线地图)
24
24
  - ✅ 精准定位(连续定位、单次定位、坐标转换)
25
25
  - ✅ 丰富的覆盖物(Circle、Marker、Polyline、Polygon、HeatMap、Cluster 等)
26
26
  - ✅ 友好的错误提示系统(详细的解决方案和文档链接)
@@ -524,10 +524,14 @@ class ExpoGaodeMapView(context: Context, appContext: AppContext) : ExpoView(cont
524
524
 
525
525
  /**
526
526
  * 移除子视图
527
+ * 延迟移除 Marker,让它们跟随地图一起延迟销毁
527
528
  */
528
529
  override fun removeView(child: View?) {
529
530
  if (child is MarkerView) {
530
- child.removeMarker()
531
+ // 延迟移除 Marker,与地图的延迟销毁时间一致(500ms)
532
+ mainHandler.postDelayed({
533
+ child.removeMarker()
534
+ }, 500)
531
535
  super.removeView(child)
532
536
  return
533
537
  }
@@ -541,6 +545,7 @@ class ExpoGaodeMapView(context: Context, appContext: AppContext) : ExpoView(cont
541
545
 
542
546
  /**
543
547
  * 按索引移除视图
548
+ * 延迟移除 Marker,让它们跟随地图一起延迟销毁
544
549
  */
545
550
  override fun removeViewAt(index: Int) {
546
551
  try {
@@ -551,7 +556,10 @@ class ExpoGaodeMapView(context: Context, appContext: AppContext) : ExpoView(cont
551
556
  }
552
557
 
553
558
  if (child is MarkerView) {
554
- child.removeMarker()
559
+ // 延迟移除 Marker,与地图的延迟销毁时间一致(500ms)
560
+ mainHandler.postDelayed({
561
+ child.removeMarker()
562
+ }, 500)
555
563
  }
556
564
 
557
565
  super.removeViewAt(index)
@@ -600,25 +608,4 @@ class ExpoGaodeMapView(context: Context, appContext: AppContext) : ExpoView(cont
600
608
  override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) {
601
609
  super.onLayout(changed, left, top, right, bottom)
602
610
  }
603
-
604
- /**
605
- * 析构函数 - 当视图被垃圾回收时调用
606
- *
607
- * 类似于 iOS 的 deinit,在视图真正被释放时才销毁地图
608
- * 这样可以避免页面退出动画未完成时地图就变成白屏的问题
609
- */
610
- protected fun finalize() {
611
- try {
612
- onDestroy()
613
- } catch (e: Exception) {
614
- // 静默处理 finalize 中的异常
615
- android.util.Log.e("ExpoGaodeMapView", "Error in finalize", e)
616
- }
617
- try {
618
- super.finalize()
619
- } catch (e: Exception) {
620
- // 静默处理异常
621
- }
622
- }
623
-
624
611
  }
@@ -15,9 +15,13 @@ class ExpoGaodeMapViewModule : Module() {
15
15
 
16
16
  // ✅ 关键修复:拦截 React Native 的视图操作异常
17
17
 
18
- // 移除 OnViewDestroys 回调,让地图在视图真正释放时才销毁
19
- // 这样可以避免页面退出动画未完成时地图就变成白屏的问题
20
- // 地图会在 finalize() 或 GC 时通过 finalize() 方法自动清理
18
+ // 延迟销毁地图,避免页面退出动画未完成时地图就变成白屏
19
+ OnViewDestroys { view: ExpoGaodeMapView ->
20
+ // 延迟 500ms 销毁地图,让页面退出动画先完成
21
+ android.os.Handler(android.os.Looper.getMainLooper()).postDelayed({
22
+ view.onDestroy()
23
+ }, 500)
24
+ }
21
25
 
22
26
 
23
27
  Prop<Int>("mapType") { view, type ->
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-gaode-map",
3
- "version": "2.2.8-next.1",
3
+ "version": "2.2.8",
4
4
  "description": "一个功能完整的高德地图 React Native 组件库,基于 Expo Modules 开发,提供地图显示、定位、覆盖物等功能。",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -21,15 +21,17 @@
21
21
  ],
22
22
  "repository": {
23
23
  "type": "git",
24
- "url": "https://github.com/TomWq/expo-gaode-map",
25
- "directory": "packages/core"
24
+ "url": "https://github.com/TomWq/expo-gaode-map"
26
25
  },
27
26
  "bugs": {
28
27
  "url": "https://github.com/TomWq/expo-gaode-map/issues"
29
28
  },
30
29
  "author": "<TomWq>(https://github.com/TomWq)",
31
30
  "license": "MIT",
32
- "homepage": "https://github.com/TomWq/expo-gaode-map/tree/main/packages/core",
31
+ "homepage": "https://github.com/TomWq/expo-gaode-map#readme",
32
+ "publishConfig": {
33
+ "registry": "https://registry.npmjs.org/"
34
+ },
33
35
  "dependencies": {
34
36
  "supercluster": "^8.0.1"
35
37
  },