expo-gaode-map 2.2.42 → 2.2.44-next.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.
- package/android/.gradle/8.9/checksums/checksums.lock +0 -0
- package/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +1 -1
- package/ios/overlays/MarkerView.swift +153 -68
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#
|
|
1
|
+
#Thu Jul 16 13:17:48 CST 2026
|
|
2
2
|
gradle.version=8.9
|
|
@@ -13,6 +13,12 @@ import UIKit
|
|
|
13
13
|
* - 支持自定义 children 视图
|
|
14
14
|
*/
|
|
15
15
|
class MarkerView: ExpoView {
|
|
16
|
+
private struct ChildrenSnapshotRequest {
|
|
17
|
+
let size: CGSize
|
|
18
|
+
let signature: String
|
|
19
|
+
let cacheKey: String
|
|
20
|
+
}
|
|
21
|
+
|
|
16
22
|
// MARK: - 事件派发器(专属事件名避免冲突)
|
|
17
23
|
var onMarkerPress = EventDispatcher()
|
|
18
24
|
var onMarkerDragStart = EventDispatcher()
|
|
@@ -78,10 +84,14 @@ class MarkerView: ExpoView {
|
|
|
78
84
|
private var pendingUpdateTask: DispatchWorkItem?
|
|
79
85
|
/// 子视图变化后的延迟刷新任务
|
|
80
86
|
private var pendingSubviewRefreshTask: DispatchWorkItem?
|
|
87
|
+
/// 子视图刷新代次,用于丢弃已经过期的主队列任务
|
|
88
|
+
private var childrenRefreshGeneration: UInt = 0
|
|
81
89
|
/// 下一次主队列确认物理 detach 是否仍然成立
|
|
82
90
|
private var pendingDetachCheckTask: DispatchWorkItem?
|
|
83
91
|
/// 最近一次应用到 annotationView 的 children 结构签名
|
|
84
92
|
private var lastRenderedChildrenSignature: String?
|
|
93
|
+
/// 最近一次应用到 annotationView 的 children 快照缓存 key
|
|
94
|
+
private var lastRenderedChildrenCacheKey: String?
|
|
85
95
|
/// 最近一次成功渲染的 children 图片,用于缓存未命中时避免闪烁
|
|
86
96
|
private var lastRenderedChildrenImage: UIImage?
|
|
87
97
|
/// 上次设置的地图引用(防止重复调用)
|
|
@@ -122,7 +132,7 @@ class MarkerView: ExpoView {
|
|
|
122
132
|
return
|
|
123
133
|
}
|
|
124
134
|
|
|
125
|
-
scheduleChildrenImageRefresh(invalidateChildrenCache:
|
|
135
|
+
scheduleChildrenImageRefresh(invalidateChildrenCache: !hasExplicitChildrenCacheKey)
|
|
126
136
|
}
|
|
127
137
|
|
|
128
138
|
/**
|
|
@@ -176,7 +186,7 @@ class MarkerView: ExpoView {
|
|
|
176
186
|
guard cacheKey != key else { return }
|
|
177
187
|
self.cacheKey = key
|
|
178
188
|
if !subviews.isEmpty {
|
|
179
|
-
scheduleChildrenImageRefresh(invalidateChildrenCache:
|
|
189
|
+
scheduleChildrenImageRefresh(invalidateChildrenCache: !hasExplicitChildrenCacheKey)
|
|
180
190
|
} else {
|
|
181
191
|
refreshAnnotationAppearance()
|
|
182
192
|
}
|
|
@@ -253,11 +263,14 @@ class MarkerView: ExpoView {
|
|
|
253
263
|
|
|
254
264
|
// 1. 如果有 children,使用自定义视图
|
|
255
265
|
if self.subviews.count > 0 {
|
|
256
|
-
let
|
|
257
|
-
|
|
258
|
-
|
|
266
|
+
let request = makeChildrenSnapshotRequest(defaultSize: CGSize(width: 200, height: 60))
|
|
267
|
+
if request.cacheKey == lastRenderedChildrenCacheKey, annotationView?.image != nil {
|
|
268
|
+
return annotationView
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
if let cached = IconBitmapCache.shared.image(forKey: request.cacheKey) {
|
|
259
272
|
if let annotationView = annotationView {
|
|
260
|
-
applyChildrenImage(cached, to: annotationView,
|
|
273
|
+
applyChildrenImage(cached, to: annotationView, request: request)
|
|
261
274
|
}
|
|
262
275
|
return annotationView
|
|
263
276
|
}
|
|
@@ -266,8 +279,14 @@ class MarkerView: ExpoView {
|
|
|
266
279
|
DispatchQueue.main.async { [weak self, weak annotationView] in
|
|
267
280
|
guard let self = self, let annotationView = annotationView else { return }
|
|
268
281
|
guard self.isAnnotationView(annotationView, boundTo: annotation) else { return }
|
|
269
|
-
|
|
270
|
-
|
|
282
|
+
let request = self.makeChildrenSnapshotRequest(defaultSize: CGSize(width: 200, height: 60))
|
|
283
|
+
if request.cacheKey == self.lastRenderedChildrenCacheKey, annotationView.image != nil {
|
|
284
|
+
return
|
|
285
|
+
}
|
|
286
|
+
if let cached = IconBitmapCache.shared.image(forKey: request.cacheKey) {
|
|
287
|
+
self.applyChildrenImage(cached, to: annotationView, request: request)
|
|
288
|
+
} else if let generated = self.createImageFromSubviews(request: request) {
|
|
289
|
+
self.applyChildrenImage(generated, to: annotationView, request: request)
|
|
271
290
|
}
|
|
272
291
|
}
|
|
273
292
|
return annotationView
|
|
@@ -347,23 +366,24 @@ class MarkerView: ExpoView {
|
|
|
347
366
|
annotationView?.isDraggable = draggable
|
|
348
367
|
self.annotationView = annotationView
|
|
349
368
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
369
|
+
let request = makeChildrenSnapshotRequest(defaultSize: CGSize(width: 200, height: 40))
|
|
370
|
+
|
|
371
|
+
if request.cacheKey == lastRenderedChildrenCacheKey, annotationView?.image != nil {
|
|
372
|
+
return annotationView
|
|
373
|
+
}
|
|
354
374
|
|
|
355
375
|
// 1) 如果缓存命中,直接同步返回图像(fast path)
|
|
356
|
-
if let cached = IconBitmapCache.shared.image(forKey:
|
|
376
|
+
if let cached = IconBitmapCache.shared.image(forKey: request.cacheKey) {
|
|
357
377
|
if let annotationView = annotationView {
|
|
358
|
-
applyChildrenImage(cached, to: annotationView,
|
|
378
|
+
applyChildrenImage(cached, to: annotationView, request: request)
|
|
359
379
|
}
|
|
360
380
|
return annotationView
|
|
361
381
|
}
|
|
362
382
|
|
|
363
383
|
// 2) 缓存未命中:先尝试同步渲染,失败时保留旧图,避免点击切态闪烁。
|
|
364
|
-
if let generated = createImageFromSubviews(
|
|
384
|
+
if let generated = createImageFromSubviews(request: request) {
|
|
365
385
|
if let annotationView = annotationView {
|
|
366
|
-
applyChildrenImage(generated, to: annotationView,
|
|
386
|
+
applyChildrenImage(generated, to: annotationView, request: request)
|
|
367
387
|
}
|
|
368
388
|
return annotationView
|
|
369
389
|
}
|
|
@@ -379,15 +399,19 @@ class MarkerView: ExpoView {
|
|
|
379
399
|
DispatchQueue.main.async { [weak self, weak annotationView] in
|
|
380
400
|
guard let self = self, let annotationView = annotationView else { return }
|
|
381
401
|
guard self.isAnnotationView(annotationView, boundTo: annotation) else { return }
|
|
402
|
+
let request = self.makeChildrenSnapshotRequest(defaultSize: CGSize(width: 200, height: 40))
|
|
403
|
+
if request.cacheKey == self.lastRenderedChildrenCacheKey, annotationView.image != nil {
|
|
404
|
+
return
|
|
405
|
+
}
|
|
382
406
|
// 再次检查缓存(避免重复渲染)
|
|
383
|
-
if let cached = IconBitmapCache.shared.image(forKey:
|
|
384
|
-
self.applyChildrenImage(cached, to: annotationView,
|
|
407
|
+
if let cached = IconBitmapCache.shared.image(forKey: request.cacheKey) {
|
|
408
|
+
self.applyChildrenImage(cached, to: annotationView, request: request)
|
|
385
409
|
return
|
|
386
410
|
}
|
|
387
411
|
|
|
388
412
|
// 调用你的原生渲染逻辑(保留空白检测、多次 layout)
|
|
389
|
-
if let generated = self.createImageFromSubviews(
|
|
390
|
-
self.applyChildrenImage(generated, to: annotationView,
|
|
413
|
+
if let generated = self.createImageFromSubviews(request: request) {
|
|
414
|
+
self.applyChildrenImage(generated, to: annotationView, request: request)
|
|
391
415
|
} else if self.hasPendingImageContent() {
|
|
392
416
|
self.scheduleSubviewRefresh(allowFallbackToDefault: false)
|
|
393
417
|
}
|
|
@@ -525,11 +549,8 @@ class MarkerView: ExpoView {
|
|
|
525
549
|
/**
|
|
526
550
|
* 将子视图转换为图片
|
|
527
551
|
*/
|
|
528
|
-
private func createImageFromSubviews(
|
|
529
|
-
let
|
|
530
|
-
let key = childrenCacheKey(for: size)
|
|
531
|
-
|
|
532
|
-
if cacheImage, let cachedImage = IconBitmapCache.shared.image(forKey: key) {
|
|
552
|
+
private func createImageFromSubviews(request: ChildrenSnapshotRequest, cacheImage: Bool = true) -> UIImage? {
|
|
553
|
+
if cacheImage, let cachedImage = IconBitmapCache.shared.image(forKey: request.cacheKey) {
|
|
533
554
|
return cachedImage
|
|
534
555
|
}
|
|
535
556
|
|
|
@@ -537,12 +558,12 @@ class MarkerView: ExpoView {
|
|
|
537
558
|
return nil
|
|
538
559
|
}
|
|
539
560
|
|
|
540
|
-
guard size.width > 0, size.height > 0 else {
|
|
561
|
+
guard request.size.width > 0, request.size.height > 0 else {
|
|
541
562
|
return nil
|
|
542
563
|
}
|
|
543
564
|
|
|
544
565
|
// 强制子视图使用指定尺寸布局
|
|
545
|
-
firstSubview.frame = CGRect(origin: .zero, size: size)
|
|
566
|
+
firstSubview.frame = CGRect(origin: .zero, size: request.size)
|
|
546
567
|
|
|
547
568
|
// 在 React Native 完成当前挂载批次后执行一次确定性布局。
|
|
548
569
|
// 后续布局变化会再次合并触发快照,不需要阻塞主 RunLoop 猜测内容何时就绪。
|
|
@@ -552,7 +573,7 @@ class MarkerView: ExpoView {
|
|
|
552
573
|
return nil
|
|
553
574
|
}
|
|
554
575
|
|
|
555
|
-
UIGraphicsBeginImageContextWithOptions(size, false, 0.0)
|
|
576
|
+
UIGraphicsBeginImageContextWithOptions(request.size, false, 0.0)
|
|
556
577
|
defer { UIGraphicsEndImageContext() }
|
|
557
578
|
|
|
558
579
|
guard let _ = UIGraphicsGetCurrentContext() else {
|
|
@@ -560,7 +581,7 @@ class MarkerView: ExpoView {
|
|
|
560
581
|
}
|
|
561
582
|
|
|
562
583
|
// 使用 drawHierarchy 而不是 layer.render,这样能正确渲染 Text
|
|
563
|
-
firstSubview.drawHierarchy(in: CGRect(origin: .zero, size: size), afterScreenUpdates: true)
|
|
584
|
+
firstSubview.drawHierarchy(in: CGRect(origin: .zero, size: request.size), afterScreenUpdates: true)
|
|
564
585
|
|
|
565
586
|
guard let image = UIGraphicsGetImageFromCurrentImageContext() else {
|
|
566
587
|
return nil
|
|
@@ -569,13 +590,17 @@ class MarkerView: ExpoView {
|
|
|
569
590
|
|
|
570
591
|
|
|
571
592
|
if cacheImage {
|
|
572
|
-
IconBitmapCache.shared.setImage(image, forKey:
|
|
593
|
+
IconBitmapCache.shared.setImage(image, forKey: request.cacheKey)
|
|
573
594
|
}
|
|
574
595
|
|
|
575
596
|
return image
|
|
576
597
|
}
|
|
577
598
|
|
|
578
|
-
private func applyChildrenImage(
|
|
599
|
+
private func applyChildrenImage(
|
|
600
|
+
_ image: UIImage,
|
|
601
|
+
to annotationView: MAAnnotationView,
|
|
602
|
+
request: ChildrenSnapshotRequest
|
|
603
|
+
) {
|
|
579
604
|
CATransaction.begin()
|
|
580
605
|
CATransaction.setDisableActions(true)
|
|
581
606
|
UIView.performWithoutAnimation {
|
|
@@ -587,9 +612,8 @@ class MarkerView: ExpoView {
|
|
|
587
612
|
}
|
|
588
613
|
CATransaction.commit()
|
|
589
614
|
lastRenderedChildrenImage = image
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
}
|
|
615
|
+
lastRenderedChildrenSignature = request.signature
|
|
616
|
+
lastRenderedChildrenCacheKey = request.cacheKey
|
|
593
617
|
}
|
|
594
618
|
|
|
595
619
|
private func currentChildrenAnnotationView() -> MAAnnotationView? {
|
|
@@ -616,14 +640,24 @@ class MarkerView: ExpoView {
|
|
|
616
640
|
return nil
|
|
617
641
|
}
|
|
618
642
|
|
|
619
|
-
private func refreshChildrenImageInPlace(
|
|
643
|
+
private func refreshChildrenImageInPlace(
|
|
644
|
+
invalidateChildrenCache: Bool = false,
|
|
645
|
+
cacheImage: Bool = true,
|
|
646
|
+
expectedGeneration: UInt? = nil
|
|
647
|
+
) {
|
|
620
648
|
guard !isRemoving else { return }
|
|
621
649
|
|
|
622
650
|
let refresh = { [weak self] in
|
|
623
651
|
guard let self = self, !self.isRemoving, !self.subviews.isEmpty else { return }
|
|
652
|
+
if let expectedGeneration,
|
|
653
|
+
self.childrenRefreshGeneration != expectedGeneration {
|
|
654
|
+
return
|
|
655
|
+
}
|
|
624
656
|
|
|
625
|
-
|
|
657
|
+
let shouldInvalidateCache = invalidateChildrenCache && !self.hasExplicitChildrenCacheKey
|
|
658
|
+
if shouldInvalidateCache {
|
|
626
659
|
self.lastRenderedChildrenSignature = nil
|
|
660
|
+
self.lastRenderedChildrenCacheKey = nil
|
|
627
661
|
self.invalidateCurrentChildrenCache()
|
|
628
662
|
}
|
|
629
663
|
|
|
@@ -632,17 +666,27 @@ class MarkerView: ExpoView {
|
|
|
632
666
|
return
|
|
633
667
|
}
|
|
634
668
|
|
|
635
|
-
let
|
|
636
|
-
|
|
637
|
-
|
|
669
|
+
let request = self.makeChildrenSnapshotRequest(defaultSize: CGSize(width: 200, height: 40))
|
|
670
|
+
|
|
671
|
+
if request.cacheKey == self.lastRenderedChildrenCacheKey, targetView.image != nil {
|
|
672
|
+
return
|
|
673
|
+
}
|
|
638
674
|
|
|
639
|
-
if cacheImage, let cached = IconBitmapCache.shared.image(forKey:
|
|
640
|
-
|
|
675
|
+
if cacheImage, let cached = IconBitmapCache.shared.image(forKey: request.cacheKey) {
|
|
676
|
+
if let expectedGeneration,
|
|
677
|
+
self.childrenRefreshGeneration != expectedGeneration {
|
|
678
|
+
return
|
|
679
|
+
}
|
|
680
|
+
self.applyChildrenImage(cached, to: targetView, request: request)
|
|
641
681
|
return
|
|
642
682
|
}
|
|
643
683
|
|
|
644
|
-
if let generated = self.createImageFromSubviews(
|
|
645
|
-
|
|
684
|
+
if let generated = self.createImageFromSubviews(request: request, cacheImage: cacheImage) {
|
|
685
|
+
if let expectedGeneration,
|
|
686
|
+
self.childrenRefreshGeneration != expectedGeneration {
|
|
687
|
+
return
|
|
688
|
+
}
|
|
689
|
+
self.applyChildrenImage(generated, to: targetView, request: request)
|
|
646
690
|
return
|
|
647
691
|
}
|
|
648
692
|
|
|
@@ -658,14 +702,30 @@ class MarkerView: ExpoView {
|
|
|
658
702
|
}
|
|
659
703
|
}
|
|
660
704
|
|
|
705
|
+
private func cancelPendingSubviewRefresh() {
|
|
706
|
+
childrenRefreshGeneration &+= 1
|
|
707
|
+
pendingSubviewRefreshTask?.cancel()
|
|
708
|
+
pendingSubviewRefreshTask = nil
|
|
709
|
+
}
|
|
710
|
+
|
|
661
711
|
private func scheduleChildrenImageRefresh(
|
|
662
712
|
invalidateChildrenCache: Bool = false,
|
|
663
713
|
cacheImage: Bool = true
|
|
664
714
|
) {
|
|
665
|
-
|
|
715
|
+
cancelPendingSubviewRefresh()
|
|
716
|
+
let scheduledGeneration = childrenRefreshGeneration
|
|
666
717
|
|
|
667
718
|
let task = DispatchWorkItem { [weak self] in
|
|
668
|
-
self
|
|
719
|
+
guard let self = self,
|
|
720
|
+
self.childrenRefreshGeneration == scheduledGeneration else {
|
|
721
|
+
return
|
|
722
|
+
}
|
|
723
|
+
self.pendingSubviewRefreshTask = nil
|
|
724
|
+
self.refreshChildrenImageInPlace(
|
|
725
|
+
invalidateChildrenCache: invalidateChildrenCache,
|
|
726
|
+
cacheImage: cacheImage,
|
|
727
|
+
expectedGeneration: scheduledGeneration
|
|
728
|
+
)
|
|
669
729
|
}
|
|
670
730
|
|
|
671
731
|
pendingSubviewRefreshTask = task
|
|
@@ -677,6 +737,11 @@ class MarkerView: ExpoView {
|
|
|
677
737
|
return "\(baseKey)|\(Int(iconWidth.rounded()))x\(Int(iconHeight.rounded()))"
|
|
678
738
|
}
|
|
679
739
|
|
|
740
|
+
private var hasExplicitChildrenCacheKey: Bool {
|
|
741
|
+
guard let cacheKey else { return false }
|
|
742
|
+
return !cacheKey.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty
|
|
743
|
+
}
|
|
744
|
+
|
|
680
745
|
private func applyCenterOffset(to annotationView: MAAnnotationView, defaultOffset: CGPoint) {
|
|
681
746
|
annotationView.centerOffset = resolvedCenterOffset(defaultOffset: defaultOffset)
|
|
682
747
|
}
|
|
@@ -755,13 +820,22 @@ class MarkerView: ExpoView {
|
|
|
755
820
|
return fallback
|
|
756
821
|
}
|
|
757
822
|
|
|
758
|
-
private func
|
|
759
|
-
|
|
760
|
-
|
|
823
|
+
private func makeChildrenSnapshotRequest(
|
|
824
|
+
size explicitSize: CGSize? = nil,
|
|
825
|
+
defaultSize: CGSize
|
|
826
|
+
) -> ChildrenSnapshotRequest {
|
|
827
|
+
let size = explicitSize ?? resolvedContentSubviewSize(defaultSize: defaultSize)
|
|
828
|
+
let explicitCacheKey = hasExplicitChildrenCacheKey ? cacheKey : nil
|
|
829
|
+
let signature = explicitCacheKey ?? childrenRenderSignature()
|
|
830
|
+
let baseKey = explicitCacheKey
|
|
761
831
|
?? "children_\(ObjectIdentifier(self).hashValue)|\(signature)"
|
|
762
832
|
let roundedWidth = Int(ceil(size.width))
|
|
763
833
|
let roundedHeight = Int(ceil(size.height))
|
|
764
|
-
return
|
|
834
|
+
return ChildrenSnapshotRequest(
|
|
835
|
+
size: size,
|
|
836
|
+
signature: signature,
|
|
837
|
+
cacheKey: "\(baseKey)|\(roundedWidth)x\(roundedHeight)"
|
|
838
|
+
)
|
|
765
839
|
}
|
|
766
840
|
|
|
767
841
|
private func childrenRenderSignature() -> String {
|
|
@@ -879,7 +953,7 @@ class MarkerView: ExpoView {
|
|
|
879
953
|
cancelPendingDetachCheck()
|
|
880
954
|
pendingAddTask?.cancel(); pendingAddTask = nil
|
|
881
955
|
pendingUpdateTask?.cancel(); pendingUpdateTask = nil
|
|
882
|
-
|
|
956
|
+
cancelPendingSubviewRefresh()
|
|
883
957
|
cleanupAnnotationFromMap()
|
|
884
958
|
onPermanentDetach?(self)
|
|
885
959
|
onPermanentDetach = nil
|
|
@@ -911,6 +985,7 @@ class MarkerView: ExpoView {
|
|
|
911
985
|
animatedAnnotationView = nil
|
|
912
986
|
lastRenderedChildrenImage = nil
|
|
913
987
|
lastRenderedChildrenSignature = nil
|
|
988
|
+
lastRenderedChildrenCacheKey = nil
|
|
914
989
|
isAnimating = false
|
|
915
990
|
lastSetMapView = nil
|
|
916
991
|
self.mapView = nil
|
|
@@ -941,10 +1016,17 @@ class MarkerView: ExpoView {
|
|
|
941
1016
|
private func scheduleSubviewRefresh(allowFallbackToDefault: Bool) {
|
|
942
1017
|
guard superview != nil else { return }
|
|
943
1018
|
|
|
944
|
-
|
|
1019
|
+
cancelPendingSubviewRefresh()
|
|
1020
|
+
let scheduledGeneration = childrenRefreshGeneration
|
|
945
1021
|
|
|
946
1022
|
let task = DispatchWorkItem { [weak self] in
|
|
947
|
-
guard let self = self,
|
|
1023
|
+
guard let self = self,
|
|
1024
|
+
!self.isRemoving,
|
|
1025
|
+
self.superview != nil,
|
|
1026
|
+
self.childrenRefreshGeneration == scheduledGeneration else {
|
|
1027
|
+
return
|
|
1028
|
+
}
|
|
1029
|
+
self.pendingSubviewRefreshTask = nil
|
|
948
1030
|
self.refreshAnnotationForSubviewChanges(allowFallbackToDefault: allowFallbackToDefault)
|
|
949
1031
|
}
|
|
950
1032
|
|
|
@@ -965,6 +1047,7 @@ class MarkerView: ExpoView {
|
|
|
965
1047
|
if subviews.isEmpty {
|
|
966
1048
|
if allowFallbackToDefault {
|
|
967
1049
|
lastRenderedChildrenSignature = nil
|
|
1050
|
+
lastRenderedChildrenCacheKey = nil
|
|
968
1051
|
annotationView = nil
|
|
969
1052
|
mapView.removeAnnotation(annotation)
|
|
970
1053
|
mapView.addAnnotation(annotation)
|
|
@@ -972,8 +1055,8 @@ class MarkerView: ExpoView {
|
|
|
972
1055
|
return
|
|
973
1056
|
}
|
|
974
1057
|
|
|
975
|
-
let
|
|
976
|
-
if
|
|
1058
|
+
let request = makeChildrenSnapshotRequest(defaultSize: CGSize(width: 200, height: 40))
|
|
1059
|
+
if request.cacheKey == lastRenderedChildrenCacheKey, annotationView?.image != nil {
|
|
977
1060
|
return
|
|
978
1061
|
}
|
|
979
1062
|
|
|
@@ -992,20 +1075,21 @@ class MarkerView: ExpoView {
|
|
|
992
1075
|
return
|
|
993
1076
|
}
|
|
994
1077
|
|
|
995
|
-
let
|
|
996
|
-
|
|
997
|
-
applyChildrenImage(image, to: annotationView, signature: signature)
|
|
1078
|
+
if let image = createImageFromSubviews(request: request) {
|
|
1079
|
+
applyChildrenImage(image, to: annotationView, request: request)
|
|
998
1080
|
}
|
|
999
1081
|
}
|
|
1000
1082
|
|
|
1001
1083
|
private func invalidateCurrentChildrenCache() {
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1084
|
+
guard !hasExplicitChildrenCacheKey else { return }
|
|
1085
|
+
|
|
1086
|
+
let requests = [
|
|
1087
|
+
makeChildrenSnapshotRequest(defaultSize: CGSize(width: 200, height: 40)),
|
|
1088
|
+
makeChildrenSnapshotRequest(defaultSize: CGSize(width: 200, height: 60))
|
|
1005
1089
|
]
|
|
1006
1090
|
|
|
1007
|
-
for
|
|
1008
|
-
IconBitmapCache.shared.removeImage(forKey:
|
|
1091
|
+
for request in requests {
|
|
1092
|
+
IconBitmapCache.shared.removeImage(forKey: request.cacheKey)
|
|
1009
1093
|
}
|
|
1010
1094
|
}
|
|
1011
1095
|
|
|
@@ -1015,11 +1099,12 @@ class MarkerView: ExpoView {
|
|
|
1015
1099
|
let refresh = { [weak self] in
|
|
1016
1100
|
guard let self = self, let mapView = self.mapView else { return }
|
|
1017
1101
|
|
|
1018
|
-
self.
|
|
1019
|
-
self.pendingSubviewRefreshTask = nil
|
|
1102
|
+
self.cancelPendingSubviewRefresh()
|
|
1020
1103
|
|
|
1021
|
-
|
|
1104
|
+
let shouldInvalidateCache = invalidateChildrenCache && !self.hasExplicitChildrenCacheKey
|
|
1105
|
+
if shouldInvalidateCache {
|
|
1022
1106
|
self.lastRenderedChildrenSignature = nil
|
|
1107
|
+
self.lastRenderedChildrenCacheKey = nil
|
|
1023
1108
|
if !self.subviews.isEmpty {
|
|
1024
1109
|
self.invalidateCurrentChildrenCache()
|
|
1025
1110
|
}
|
|
@@ -1162,7 +1247,7 @@ class MarkerView: ExpoView {
|
|
|
1162
1247
|
guard contentWidth != width else { return }
|
|
1163
1248
|
contentWidth = width
|
|
1164
1249
|
if !subviews.isEmpty {
|
|
1165
|
-
scheduleChildrenImageRefresh(invalidateChildrenCache:
|
|
1250
|
+
scheduleChildrenImageRefresh(invalidateChildrenCache: !hasExplicitChildrenCacheKey)
|
|
1166
1251
|
}
|
|
1167
1252
|
}
|
|
1168
1253
|
|
|
@@ -1170,7 +1255,7 @@ class MarkerView: ExpoView {
|
|
|
1170
1255
|
guard contentHeight != height else { return }
|
|
1171
1256
|
contentHeight = height
|
|
1172
1257
|
if !subviews.isEmpty {
|
|
1173
|
-
scheduleChildrenImageRefresh(invalidateChildrenCache:
|
|
1258
|
+
scheduleChildrenImageRefresh(invalidateChildrenCache: !hasExplicitChildrenCacheKey)
|
|
1174
1259
|
}
|
|
1175
1260
|
}
|
|
1176
1261
|
|
|
@@ -1419,7 +1504,7 @@ class MarkerView: ExpoView {
|
|
|
1419
1504
|
// 取消待处理的任务
|
|
1420
1505
|
pendingAddTask?.cancel()
|
|
1421
1506
|
pendingUpdateTask?.cancel()
|
|
1422
|
-
|
|
1507
|
+
cancelPendingSubviewRefresh()
|
|
1423
1508
|
pendingDetachCheckTask?.cancel()
|
|
1424
1509
|
|
|
1425
1510
|
if Thread.isMainThread {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-gaode-map",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.44-next.0",
|
|
4
4
|
"description": "Expo Modules AMap (Gaode Map) stack for Expo/React Native: Config Plugin, New Architecture support, maps, location, search, offline maps, and react-native-amap3d migration guidance.",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|