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

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.
@@ -601,4 +601,24 @@ class ExpoGaodeMapView(context: Context, appContext: AppContext) : ExpoView(cont
601
601
  super.onLayout(changed, left, top, right, bottom)
602
602
  }
603
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
+
604
624
  }
@@ -14,11 +14,10 @@ class ExpoGaodeMapViewModule : Module() {
14
14
  Events("onMapPress", "onMapLongPress", "onLoad", "onLocation", "onCameraMove", "onCameraIdle")
15
15
 
16
16
  // ✅ 关键修复:拦截 React Native 的视图操作异常
17
-
18
- OnViewDestroys { view: ExpoGaodeMapView ->
19
- // 销毁地图实例,释放资源
20
- view.onDestroy()
21
- }
17
+
18
+ // 移除 OnViewDestroys 回调,让地图在视图真正释放时才销毁
19
+ // 这样可以避免页面退出动画未完成时地图就变成白屏的问题
20
+ // 地图会在 finalize() 或 GC 时通过 finalize() 方法自动清理
22
21
 
23
22
 
24
23
  Prop<Int>("mapType") { view, type ->
@@ -87,4 +86,4 @@ class ExpoGaodeMapViewModule : Module() {
87
86
  }
88
87
  }
89
88
  }
90
- }
89
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-gaode-map",
3
- "version": "2.2.7",
3
+ "version": "2.2.8-next.1",
4
4
  "description": "一个功能完整的高德地图 React Native 组件库,基于 Expo Modules 开发,提供地图显示、定位、覆盖物等功能。",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",