Skip to content

Commit 2ebe13b

Browse files
authored
fix(iOS): janky tab switch between colored and uncolored tabs (#519)
1 parent 1c5b385 commit 2ebe13b

3 files changed

Lines changed: 11 additions & 9 deletions

File tree

.changeset/stable-tab-tint.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'react-native-bottom-tabs': patch
3+
---
4+
5+
Keep iOS tab transitions smooth when switching between tabs with and without active tint colors.

apps/example/ios/Podfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2842,7 +2842,7 @@ SPEC CHECKSUMS:
28422842
React-logger: a3cb5b29c32b8e447b5a96919340e89334062b48
28432843
React-Mapbuffer: 9d2434a42701d6144ca18f0ca1c4507808ca7696
28442844
React-microtasksnativemodule: 75b6604b667d297292345302cc5bfb6b6aeccc1b
2845-
react-native-bottom-tabs: 5b7b8ee99ea2f19a496cabe8f6ec322b4d86c28d
2845+
react-native-bottom-tabs: df48704fe0d3f7566ab63e2b77b47e40f74a9051
28462846
react-native-safe-area-context: c6e2edd1c1da07bdce287fa9d9e60c5f7b514616
28472847
React-NativeModulesApple: 879fbdc5dcff7136abceb7880fe8a2022a1bd7c3
28482848
React-oscompat: 93b5535ea7f7dff46aaee4f78309a70979bdde9d

packages/react-native-bottom-tabs/ios/TabViewImpl.swift

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -267,15 +267,12 @@ extension View {
267267

268268
@ViewBuilder
269269
func tintColor(_ color: PlatformColor?) -> some View {
270-
if let color {
271-
let color = Color(color)
272-
if #available(iOS 16.0, tvOS 16.0, macOS 13.0, *) {
273-
self.tint(color)
274-
} else {
275-
self.accentColor(color)
276-
}
270+
let color = color.map(Color.init)
271+
272+
if #available(iOS 16.0, tvOS 16.0, macOS 13.0, *) {
273+
self.tint(color)
277274
} else {
278-
self
275+
self.accentColor(color)
279276
}
280277
}
281278

0 commit comments

Comments
 (0)