@onekeyfe/react-native-bottom-tabs 6.7.0-41 → 6.7.0-44
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/docs/SPEC.md +12 -0
- package/ios/RCTBottomTabsContainerView.swift +31 -4
- package/package.json +1 -1
package/docs/SPEC.md
CHANGED
|
@@ -52,6 +52,18 @@ the routes array or supplying a new resolver recomputes both arrays. On Android,
|
|
|
52
52
|
and swaps each `MenuItem`'s icon synchronously on the UI thread when selection
|
|
53
53
|
changes.
|
|
54
54
|
|
|
55
|
+
## iOS icon completion updates
|
|
56
|
+
|
|
57
|
+
When normal or selected artwork arrives, update the existing `UITabBarItem`
|
|
58
|
+
images without rebuilding controllers or replacing items. Coalesce completed
|
|
59
|
+
indices into one main-queue update; use the current source/token ownership and
|
|
60
|
+
current tints, including SF Symbol and normal-image fallbacks. Item identity,
|
|
61
|
+
selection, labels, badges and accessibility identifiers remain intact. Structural
|
|
62
|
+
item changes retain the existing rebuild path. Android is unchanged.
|
|
63
|
+
|
|
64
|
+
Consumer simulator evidence covers cold launch, tab switching and light/dark
|
|
65
|
+
icon tint. Physical-device and rapid source/reorder acceptance remain pending.
|
|
66
|
+
|
|
55
67
|
## Native left drawer
|
|
56
68
|
|
|
57
69
|
Status: implemented in module source. Package TypeScript, iOS/Android Fabric
|
|
@@ -139,6 +139,8 @@ class RCTBottomTabsContainerView: UIView {
|
|
|
139
139
|
private var lastPressedTabTime: CFTimeInterval = 0
|
|
140
140
|
/// Cached view controllers keyed by tab key to avoid unnecessary reparenting
|
|
141
141
|
private var cachedViewControllers: [String: UIViewController] = [:]
|
|
142
|
+
private var pendingIconUpdates = Set<Int>()
|
|
143
|
+
private var isIconUpdateScheduled = false
|
|
142
144
|
// Vertical tab bar (iPhone Duo side strip): last reported placement and the
|
|
143
145
|
// round accessory button drawn above the bar.
|
|
144
146
|
private var reportedTabBarPlacement: String?
|
|
@@ -684,6 +686,31 @@ class RCTBottomTabsContainerView: UIView {
|
|
|
684
686
|
scheduleSideAccessoryLayout()
|
|
685
687
|
}
|
|
686
688
|
|
|
689
|
+
private func scheduleIconUpdate(at index: Int) {
|
|
690
|
+
pendingIconUpdates.insert(index)
|
|
691
|
+
guard !isIconUpdateScheduled else { return }
|
|
692
|
+
isIconUpdateScheduled = true
|
|
693
|
+
DispatchQueue.main.async { [weak self] in
|
|
694
|
+
guard let self else { return }
|
|
695
|
+
self.isIconUpdateScheduled = false
|
|
696
|
+
let indices = self.pendingIconUpdates
|
|
697
|
+
self.pendingIconUpdates.removeAll()
|
|
698
|
+
let allItems = self.parsedItems
|
|
699
|
+
for index in indices.sorted() {
|
|
700
|
+
guard allItems.indices.contains(index),
|
|
701
|
+
let vc = self.cachedViewControllers[allItems[index].key],
|
|
702
|
+
let item = vc.tabBarItem else { continue }
|
|
703
|
+
let symbol = allItems[index].sfSymbol ?? ""
|
|
704
|
+
let fallback = symbol.isEmpty ? nil : UIImage(systemName: symbol)
|
|
705
|
+
let image = self.loadedIcons[index] ?? fallback
|
|
706
|
+
let selectedImage = self.loadedSelectedIcons[index] ?? fallback ?? image
|
|
707
|
+
// Preserve the item and controller identities while artwork arrives.
|
|
708
|
+
item.image = self.bakeTint(image, self.inactiveTintColor)
|
|
709
|
+
item.selectedImage = self.bakeTint(selectedImage, self.activeTintColor)
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
|
|
687
714
|
// MARK: - Selection
|
|
688
715
|
|
|
689
716
|
private func updateSelectedTab() {
|
|
@@ -1039,7 +1066,7 @@ class RCTBottomTabsContainerView: UIView {
|
|
|
1039
1066
|
scaledImage = image
|
|
1040
1067
|
}
|
|
1041
1068
|
self.loadedIcons[index] = scaledImage
|
|
1042
|
-
self.
|
|
1069
|
+
self.scheduleIconUpdate(at: index)
|
|
1043
1070
|
}
|
|
1044
1071
|
continue
|
|
1045
1072
|
}
|
|
@@ -1064,7 +1091,7 @@ class RCTBottomTabsContainerView: UIView {
|
|
|
1064
1091
|
DispatchQueue.main.async {
|
|
1065
1092
|
guard self.iconRequestTokens[index] === token else { return }
|
|
1066
1093
|
self.loadedIcons[index] = image.resizeImageTo(size: self.iconSize)
|
|
1067
|
-
self.
|
|
1094
|
+
self.scheduleIconUpdate(at: index)
|
|
1068
1095
|
}
|
|
1069
1096
|
})
|
|
1070
1097
|
}
|
|
@@ -1112,7 +1139,7 @@ class RCTBottomTabsContainerView: UIView {
|
|
|
1112
1139
|
scaledImage = image
|
|
1113
1140
|
}
|
|
1114
1141
|
self.loadedSelectedIcons[index] = scaledImage
|
|
1115
|
-
self.
|
|
1142
|
+
self.scheduleIconUpdate(at: index)
|
|
1116
1143
|
}
|
|
1117
1144
|
continue
|
|
1118
1145
|
}
|
|
@@ -1137,7 +1164,7 @@ class RCTBottomTabsContainerView: UIView {
|
|
|
1137
1164
|
DispatchQueue.main.async {
|
|
1138
1165
|
guard self.selectedIconRequestTokens[index] === token else { return }
|
|
1139
1166
|
self.loadedSelectedIcons[index] = image.resizeImageTo(size: self.iconSize)
|
|
1140
|
-
self.
|
|
1167
|
+
self.scheduleIconUpdate(at: index)
|
|
1141
1168
|
}
|
|
1142
1169
|
})
|
|
1143
1170
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/react-native-bottom-tabs",
|
|
3
|
-
"version": "6.7.0-
|
|
3
|
+
"version": "6.7.0-44",
|
|
4
4
|
"description": "Native bottom tabs (tab bar + scene container) for React Native on iOS and Android",
|
|
5
5
|
"source": "./src/index.tsx",
|
|
6
6
|
"main": "./lib/module/index.js",
|