expo-gaode-map 1.1.1 → 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.
@@ -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) = uiManager.setShowsUserLocation(show, followUserLocation)
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
- uiManager.setShowsUserLocation(true, follow)
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
  }
@@ -2,6 +2,10 @@ package expo.modules.gaodemap.managers
2
2
 
3
3
  import android.content.Context
4
4
  import android.graphics.BitmapFactory
5
+ import android.location.Location
6
+ import android.location.LocationListener
7
+ import android.location.LocationManager as AndroidLocationManager
8
+ import android.os.Bundle
5
9
  import com.amap.api.maps.AMap
6
10
  import com.amap.api.maps.LocationSource
7
11
  import com.amap.api.maps.model.BitmapDescriptorFactory
@@ -14,10 +18,13 @@ import java.net.URL
14
18
  * UI 和手势管理器
15
19
  * 负责地图控件显示、手势控制、图层显示等
16
20
  */
17
- class UIManager(private val aMap: AMap, private val context: Context) {
21
+ class UIManager(private val aMap: AMap, private val context: Context) : LocationListener {
18
22
 
19
23
  var onLocationChanged: ((latitude: Double, longitude: Double, accuracy: Float) -> Unit)? = null
20
24
 
25
+ private var locationManager: AndroidLocationManager? = null
26
+ private var locationChangedListener: LocationSource.OnLocationChangedListener? = null
27
+
21
28
  // ==================== 控件显示 ====================
22
29
 
23
30
  /**
@@ -79,27 +86,38 @@ class UIManager(private val aMap: AMap, private val context: Context) {
79
86
  * 设置是否显示用户位置
80
87
  */
81
88
  fun setShowsUserLocation(show: Boolean, followUserLocation: Boolean = false) {
89
+ android.util.Log.d("UIManager", "🔵 setShowsUserLocation: show=$show, follow=$followUserLocation")
90
+
82
91
  if (show) {
92
+ // 创建默认的定位样式
83
93
  if (currentLocationStyle == null) {
84
- currentLocationStyle = MyLocationStyle()
85
- }
86
- val locationType = if (followUserLocation) {
87
- MyLocationStyle.LOCATION_TYPE_FOLLOW
94
+ currentLocationStyle = MyLocationStyle().apply {
95
+ // 根据是否跟随设置定位类型
96
+ val locationType = if (followUserLocation) {
97
+ MyLocationStyle.LOCATION_TYPE_FOLLOW // 连续定位并跟随
98
+ } else {
99
+ MyLocationStyle.LOCATION_TYPE_SHOW // 只显示定位点,不跟随
100
+ }
101
+ myLocationType(locationType)
102
+ interval(2000) // 2秒定位一次
103
+ showMyLocation(true)
104
+ }
105
+ android.util.Log.d("UIManager", "✨ 创建默认 MyLocationStyle,类型: ${if (followUserLocation) "FOLLOW" else "SHOW"}")
88
106
  } else {
89
- MyLocationStyle.LOCATION_TYPE_SHOW
90
- }
91
- currentLocationStyle?.myLocationType(locationType)
92
- aMap.myLocationStyle = currentLocationStyle
93
-
94
- // 设置定位监听
95
- aMap.setLocationSource(object : LocationSource {
96
- override fun activate(listener: LocationSource.OnLocationChangedListener?) {
97
- // 高德地图会自动处理定位,我们只需要监听位置变化
107
+ // 更新定位类型
108
+ val locationType = if (followUserLocation) {
109
+ MyLocationStyle.LOCATION_TYPE_FOLLOW
110
+ } else {
111
+ MyLocationStyle.LOCATION_TYPE_SHOW
112
+ }
113
+ currentLocationStyle?.apply {
114
+ myLocationType(locationType)
115
+ interval(2000)
98
116
  }
99
- override fun deactivate() {}
100
- })
117
+ android.util.Log.d("UIManager", "🔄 更新定位类型: ${if (followUserLocation) "FOLLOW" else "SHOW"}")
118
+ }
101
119
 
102
- // 监听定位变化
120
+ // 监听定位变化(用于通知 React Native)
103
121
  aMap.setOnMyLocationChangeListener { location ->
104
122
  onLocationChanged?.invoke(
105
123
  location.latitude,
@@ -108,112 +126,266 @@ class UIManager(private val aMap: AMap, private val context: Context) {
108
126
  )
109
127
  }
110
128
 
129
+ // 应用定位样式
130
+ aMap.myLocationStyle = currentLocationStyle
131
+
132
+ // 启用定位(使用高德地图自己的定位)
111
133
  aMap.isMyLocationEnabled = true
134
+ android.util.Log.d("UIManager", "✅ 定位已启用")
135
+
112
136
  } else {
113
137
  aMap.setOnMyLocationChangeListener(null)
114
138
  aMap.isMyLocationEnabled = false
139
+ android.util.Log.d("UIManager", "❌ 定位已禁用")
140
+ }
141
+ }
142
+
143
+ /**
144
+ * 启动真实的系统定位
145
+ */
146
+ private fun startRealLocation() {
147
+ try {
148
+ if (locationManager == null) {
149
+ locationManager = context.getSystemService(Context.LOCATION_SERVICE) as AndroidLocationManager
150
+ }
151
+
152
+ val providers = locationManager?.getProviders(true) ?: emptyList()
153
+ android.util.Log.d("UIManager", "📡 可用的定位提供者: $providers")
154
+
155
+ // 优先使用 GPS,其次是网络定位
156
+ val provider = when {
157
+ providers.contains(AndroidLocationManager.GPS_PROVIDER) -> {
158
+ android.util.Log.d("UIManager", "✅ 使用 GPS 定位")
159
+ AndroidLocationManager.GPS_PROVIDER
160
+ }
161
+ providers.contains(AndroidLocationManager.NETWORK_PROVIDER) -> {
162
+ android.util.Log.d("UIManager", "✅ 使用网络定位")
163
+ AndroidLocationManager.NETWORK_PROVIDER
164
+ }
165
+ else -> {
166
+ android.util.Log.e("UIManager", "❌ 没有可用的定位提供者")
167
+ return
168
+ }
169
+ }
170
+
171
+ // 请求位置更新
172
+ locationManager?.requestLocationUpdates(
173
+ provider,
174
+ 2000L, // 最小时间间隔 2秒
175
+ 10f, // 最小距离变化 10米
176
+ this
177
+ )
178
+
179
+ // 立即获取最后已知位置
180
+ val lastLocation = locationManager?.getLastKnownLocation(provider)
181
+ if (lastLocation != null) {
182
+ android.util.Log.d("UIManager", "📍 获取到最后已知位置: ${lastLocation.latitude}, ${lastLocation.longitude}")
183
+ onLocationChanged(lastLocation)
184
+ } else {
185
+ android.util.Log.d("UIManager", "⏳ 等待首次定位...")
186
+ }
187
+
188
+ } catch (e: SecurityException) {
189
+ android.util.Log.e("UIManager", "❌ 定位权限未授予: ${e.message}")
190
+ } catch (e: Exception) {
191
+ android.util.Log.e("UIManager", "❌ 启动定位失败: ${e.message}", e)
115
192
  }
116
193
  }
117
194
 
195
+ /**
196
+ * 停止系统定位
197
+ */
198
+ private fun stopRealLocation() {
199
+ try {
200
+ locationManager?.removeUpdates(this)
201
+ android.util.Log.d("UIManager", "🛑 已停止系统定位")
202
+ } catch (e: Exception) {
203
+ android.util.Log.e("UIManager", "停止定位失败: ${e.message}")
204
+ }
205
+ }
206
+
207
+ /**
208
+ * 位置变化回调
209
+ */
210
+ override fun onLocationChanged(location: Location) {
211
+ android.util.Log.d("UIManager", "📍📍📍 系统定位回调: lat=${location.latitude}, lng=${location.longitude}, accuracy=${location.accuracy}m")
212
+
213
+ // 通知高德地图
214
+ locationChangedListener?.onLocationChanged(location)
215
+
216
+ // 通知 React Native
217
+ onLocationChanged?.invoke(
218
+ location.latitude,
219
+ location.longitude,
220
+ location.accuracy
221
+ )
222
+ }
223
+
224
+ override fun onStatusChanged(provider: String?, status: Int, extras: Bundle?) {
225
+ android.util.Log.d("UIManager", "定位状态变化: provider=$provider, status=$status")
226
+ }
227
+
228
+ override fun onProviderEnabled(provider: String) {
229
+ android.util.Log.d("UIManager", "✅ 定位提供者已启用: $provider")
230
+ }
231
+
232
+ override fun onProviderDisabled(provider: String) {
233
+ android.util.Log.d("UIManager", "❌ 定位提供者已禁用: $provider")
234
+ }
235
+
118
236
  /**
119
237
  * 设置用户位置样式
120
238
  * 统一 iOS 和 Android 的 API
121
239
  */
122
240
  fun setUserLocationRepresentation(config: Map<String, Any>) {
241
+ android.util.Log.d("UIManager", "🎨 setUserLocationRepresentation 被调用,配置: $config")
242
+
123
243
  if (currentLocationStyle == null) {
124
- currentLocationStyle = MyLocationStyle()
244
+ currentLocationStyle = MyLocationStyle().apply {
245
+ myLocationType(MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE)
246
+ interval(2000)
247
+ showMyLocation(true)
248
+ }
249
+ android.util.Log.d("UIManager", "创建新的 MyLocationStyle")
125
250
  }
126
251
 
127
252
  val style = currentLocationStyle!!
128
253
 
129
- // 精度圈边线颜色 (strokeColor)
130
- config["strokeColor"]?.let {
131
- style.strokeColor(ColorParser.parseColor(it))
132
- }
133
-
134
- // 精度圈填充颜色 (fillColor)
135
- config["fillColor"]?.let {
136
- style.radiusFillColor(ColorParser.parseColor(it))
137
- }
138
-
139
- // 精度圈边线宽度 (lineWidth)
140
- (config["lineWidth"] as? Number)?.let {
141
- style.strokeWidth(it.toFloat())
142
- }
143
-
144
- // 是否显示精度圈 (showsAccuracyRing)
145
- (config["showsAccuracyRing"] as? Boolean)?.let { showRing ->
146
- if (!showRing) {
147
- // 不显示精度圈,但要显示蓝点
148
- style.radiusFillColor(android.graphics.Color.TRANSPARENT)
149
- style.strokeColor(android.graphics.Color.TRANSPARENT)
254
+ // 是否显示精度圈 (showsAccuracyRing) - 先处理这个,设置默认值
255
+ val showsAccuracyRing = config["showsAccuracyRing"] as? Boolean ?: true
256
+ if (!showsAccuracyRing) {
257
+ // 不显示精度圈 - 设置透明色
258
+ style.radiusFillColor(android.graphics.Color.TRANSPARENT)
259
+ style.strokeColor(android.graphics.Color.TRANSPARENT)
260
+ style.strokeWidth(0f)
261
+ } else {
262
+ // 显示精度圈 - 使用自定义颜色或默认值
263
+
264
+ // 精度圈填充颜色 (fillColor)
265
+ config["fillColor"]?.let {
266
+ style.radiusFillColor(ColorParser.parseColor(it))
267
+ }
268
+
269
+ // 精度圈边线颜色 (strokeColor)
270
+ config["strokeColor"]?.let {
271
+ style.strokeColor(ColorParser.parseColor(it))
272
+ }
273
+
274
+ // 精度圈边线宽度 (lineWidth)
275
+ (config["lineWidth"] as? Number)?.let {
276
+ style.strokeWidth(it.toFloat())
150
277
  }
151
278
  }
152
279
 
153
280
  // 自定义图标 (image)
154
- (config["image"] as? String)?.let { imagePath ->
281
+ val imagePath = config["image"] as? String
282
+ if (imagePath != null && imagePath.isNotEmpty()) {
283
+ android.util.Log.d("UIManager", "开始加载自定义定位图标: $imagePath")
155
284
 
156
285
  // 将 dp 转换为 px (与 iOS points 对应)
157
286
  val density = context.resources.displayMetrics.density
158
287
  val imageWidth = (config["imageWidth"] as? Number)?.let { (it.toFloat() * density).toInt() }
159
288
  val imageHeight = (config["imageHeight"] as? Number)?.let { (it.toFloat() * density).toInt() }
160
289
 
290
+ android.util.Log.d("UIManager", "图标尺寸: width=$imageWidth, height=$imageHeight, density=$density")
291
+
161
292
  // 网络图片需要在后台线程加载
162
293
  if (imagePath.startsWith("http://") || imagePath.startsWith("https://")) {
163
294
  Thread {
164
295
  try {
165
296
  val originalBitmap = BitmapFactory.decodeStream(URL(imagePath).openStream())
166
297
  android.os.Handler(android.os.Looper.getMainLooper()).post {
167
- originalBitmap?.let { bitmap ->
298
+ if (originalBitmap != null) {
168
299
  val scaledBitmap = if (imageWidth != null && imageHeight != null) {
169
- android.graphics.Bitmap.createScaledBitmap(bitmap, imageWidth, imageHeight, true)
170
- } else bitmap
300
+ android.graphics.Bitmap.createScaledBitmap(originalBitmap, imageWidth, imageHeight, true)
301
+ } else originalBitmap
171
302
 
303
+ android.util.Log.d("UIManager", "✅ 网络图片加载成功 (${scaledBitmap.width}x${scaledBitmap.height}),应用到定位样式")
172
304
  style.myLocationIcon(BitmapDescriptorFactory.fromBitmap(scaledBitmap))
305
+
306
+ // 重新应用样式并确保定位开启
173
307
  aMap.myLocationStyle = style
174
- } ?: android.util.Log.e("UIManager", "网络图片加载失败")
308
+
309
+ // 如果定位没开,重新开启
310
+ if (!aMap.isMyLocationEnabled) {
311
+ android.util.Log.d("UIManager", "⚠️ 定位未启用,重新启用")
312
+ aMap.isMyLocationEnabled = true
313
+ }
314
+
315
+ android.util.Log.d("UIManager", "✅ 定位样式重新应用完成,定位状态: ${aMap.isMyLocationEnabled}")
316
+ } else {
317
+ android.util.Log.e("UIManager", "❌ 网络图片加载失败: bitmap is null")
318
+ }
175
319
  }
176
320
  } catch (e: Exception) {
177
- android.util.Log.e("UIManager", "加载网络图片异常", e)
321
+ android.util.Log.e("UIManager", "❌ 加载网络图片异常: ${e.message}", e)
178
322
  }
179
323
  }.start()
324
+ return // 异步加载,提前返回
180
325
  } else {
181
- // 本地图片也在后台线程加载,避免阻塞主线程
326
+ // 本地图片在后台线程加载
182
327
  Thread {
183
328
  try {
184
329
  val originalBitmap = when {
185
330
  imagePath.startsWith("file://") -> {
331
+ android.util.Log.d("UIManager", "加载文件路径图片: ${imagePath.substring(7)}")
186
332
  BitmapFactory.decodeFile(imagePath.substring(7))
187
333
  }
188
334
  else -> {
335
+ // 尝试从资源加载
336
+ val fileName = imagePath.substringBeforeLast('.')
337
+ android.util.Log.d("UIManager", "尝试从资源加载: $fileName")
189
338
  val resId = context.resources.getIdentifier(
190
- imagePath.substringBeforeLast('.'),
339
+ fileName,
191
340
  "drawable",
192
341
  context.packageName
193
342
  )
343
+ android.util.Log.d("UIManager", "资源 ID: $resId")
194
344
  if (resId != 0) {
195
345
  BitmapFactory.decodeResource(context.resources, resId)
196
- } else null
346
+ } else {
347
+ // 尝试直接作为文件路径
348
+ android.util.Log.d("UIManager", "尝试作为文件路径加载: $imagePath")
349
+ BitmapFactory.decodeFile(imagePath)
350
+ }
197
351
  }
198
352
  }
199
353
 
200
354
  android.os.Handler(android.os.Looper.getMainLooper()).post {
201
- originalBitmap?.let { bitmap ->
355
+ if (originalBitmap != null) {
202
356
  val scaledBitmap = if (imageWidth != null && imageHeight != null) {
203
- android.graphics.Bitmap.createScaledBitmap(bitmap, imageWidth, imageHeight, true)
204
- } else bitmap
357
+ android.graphics.Bitmap.createScaledBitmap(originalBitmap, imageWidth, imageHeight, true)
358
+ } else originalBitmap
205
359
 
360
+ android.util.Log.d("UIManager", "✅ 本地图片加载成功 (${scaledBitmap.width}x${scaledBitmap.height}),应用到定位样式")
206
361
  style.myLocationIcon(BitmapDescriptorFactory.fromBitmap(scaledBitmap))
362
+
363
+ // 重新应用样式并确保定位开启
207
364
  aMap.myLocationStyle = style
208
- } ?: android.util.Log.e("UIManager", "本地图片加载失败")
365
+
366
+ // 如果定位没开,重新开启
367
+ if (!aMap.isMyLocationEnabled) {
368
+ android.util.Log.d("UIManager", "⚠️ 定位未启用,重新启用")
369
+ aMap.isMyLocationEnabled = true
370
+ }
371
+
372
+ android.util.Log.d("UIManager", "✅ 定位样式重新应用完成,定位状态: ${aMap.isMyLocationEnabled}")
373
+ } else {
374
+ android.util.Log.e("UIManager", "❌ 本地图片加载失败: bitmap is null, path=$imagePath")
375
+ }
209
376
  }
210
377
  } catch (e: Exception) {
211
- android.util.Log.e("UIManager", "加载本地图片异常", e)
378
+ android.util.Log.e("UIManager", "❌ 加载本地图片异常: ${e.message}", e)
212
379
  }
213
380
  }.start()
381
+ return // 异步加载,提前返回
214
382
  }
383
+ } else {
384
+ // 没有自定义图标,使用默认蓝点
385
+ android.util.Log.d("UIManager", "使用默认定位图标(蓝点)")
215
386
  }
216
387
 
388
+ // 立即应用样式(针对没有自定义图标的情况)
217
389
  aMap.myLocationStyle = style
218
390
  }
219
391
 
@@ -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
- mainHandler.postDelayed({
554
- android.util.Log.d("MarkerView", "⏰ removeView 延迟更新,childCount = $childCount")
555
- if (childCount == 0 && marker != null) {
556
- android.util.Log.d("MarkerView", "📍 所有子视图已移除,恢复默认图标")
557
- marker?.setIcon(BitmapDescriptorFactory.defaultMarker())
558
- marker?.setAnchor(0.5f, 1.0f)
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
- }, 50)
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
- if (index >= 0 && index < childCount) {
566
- super.removeViewAt(index)
567
-
568
- // 子视图被移除后,清除图标或恢复默认图标
569
- mainHandler.postDelayed({
570
- android.util.Log.d("MarkerView", "⏰ removeViewAt 延迟更新,childCount = $childCount")
571
- if (childCount == 0 && marker != null) {
572
- android.util.Log.d("MarkerView", "📍 所有子视图已移除,恢复默认图标")
573
- marker?.setIcon(BitmapDescriptorFactory.defaultMarker())
574
- marker?.setAnchor(0.5f, 1.0f)
575
- } else if (childCount > 0 && marker != null) {
576
- android.util.Log.d("MarkerView", "🔄 还有子视图,更新图标")
577
- updateMarkerIcon()
578
- }
579
- }, 50)
580
- } else {
581
- android.util.Log.w("MarkerView", "⚠️ removeViewAt: 无效的索引 $index,childCount = $childCount")
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<GeolocationPosition>) => void;
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,EAAC,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGnG;;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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AAC,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<GeolocationPosition>) => 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"]}
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-gaode-map",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "一个功能完整的高德地图 React Native 组件库,基于 Expo Modules 开发,提供地图显示、定位、覆盖物等功能。",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -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<GeolocationPosition>) => void;
221
+ onLocation?: (event: NativeSyntheticEvent<LocationEvent>) => void;
202
222
 
203
223
  /**
204
224
  * Marker 点击事件