Skip to content

Commit 2a8a9a0

Browse files
authored
fix(iOS): disable tabBarInactiveTintColor on iOS >= 26 (#527)
1 parent f2e12e7 commit 2a8a9a0

7 files changed

Lines changed: 34 additions & 9 deletions

File tree

.changeset/grumpy-otters-report.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+
Disable tabBarInactiveTintColor on iOS >= 26

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
#
33
.DS_Store
44

5-
# XDE
6-
.expo/
7-
85
# VSCode
96
.vscode/
107
jsconfig.json
@@ -82,3 +79,6 @@ lib/
8279
# React Native Codegen
8380
ios/generated
8481
android/generated
82+
83+
# Codex
84+
.codex

docs/docs/docs/guides/standalone-usage.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,10 @@ Color for inactive tabs.
180180

181181
- Type: `ColorValue`
182182

183+
:::note
184+
On iOS >= 26 (Liquid Glass), this prop is ignored.
185+
:::
186+
183187
#### `tabBarStyle`
184188

185189
Object containing styles for the tab bar.

docs/docs/docs/guides/usage-with-react-navigation.mdx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ Color for the active tab.
128128

129129
Color for the inactive tabs.
130130

131+
:::note
132+
On iOS >= 26 (Liquid Glass), this prop is ignored.
133+
:::
134+
131135
#### `tabBarStyle`
132136

133137
Object containing styles for the tab bar.
@@ -241,7 +245,7 @@ Label text of the tab displayed in the navigation bar. When undefined, scene tit
241245
Color for the active tab.
242246

243247
:::note
244-
The `tabBarInactiveTintColor` is not supported on route level due to native limitations. Use `inactiveTintColor` in the `Tab.Navigator` instead.
248+
The `tabBarInactiveTintColor` is not supported on route level due to native limitations. Use `tabBarInactiveTintColor` in the `Tab.Navigator` instead.
245249
:::
246250

247251
#### `tabBarIcon`
@@ -312,7 +316,7 @@ To display a badge without text (just a dot), you need to pass a string with a s
312316
#### `tabBarBadgeBackgroundColor`
313317

314318
- Type: `string`
315-
319+
316320
Set the background color for the badge on android.
317321
Uses the system color by default.
318322

@@ -395,7 +399,7 @@ React.useEffect(() => {
395399
const unsubscribe = navigation.addListener('tabPress', (e) => {
396400
// Note: For iOS 26+, use the `preventsDefault` option instead of `e.preventDefault()`
397401
// to avoid animation delays
398-
402+
399403
// Do something manually
400404
// ...
401405
});

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ struct TabViewImpl: View {
132132
#if !os(visionOS)
133133
tabBar.isTranslucent = props.translucent
134134
#endif
135-
tabBar.unselectedItemTintColor = props.inactiveTintColor
135+
tabBar.unselectedItemTintColor = props.effectiveInactiveTintColor
136136

137137
guard let items = tabBar.items else { return }
138138

@@ -174,10 +174,10 @@ struct TabViewImpl: View {
174174
fontSize: props.fontSize,
175175
fontFamily: props.fontFamily,
176176
fontWeight: props.fontWeight,
177-
inactiveColor: props.inactiveTintColor
177+
inactiveColor: props.effectiveInactiveTintColor
178178
)
179179

180-
if let inactiveTintColor = props.inactiveTintColor {
180+
if let inactiveTintColor = props.effectiveInactiveTintColor {
181181
itemAppearance.normal.iconColor = inactiveTintColor
182182
}
183183

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import Foundation
12
import SwiftUI
23

34
internal enum MinimizeBehavior: String {
@@ -82,6 +83,16 @@ class TabViewProps: ObservableObject {
8283
return activeTintColor
8384
}
8485

86+
var effectiveInactiveTintColor: PlatformColor? {
87+
#if os(iOS)
88+
if ProcessInfo.processInfo.operatingSystemVersion.majorVersion >= 26 {
89+
return nil
90+
}
91+
#endif
92+
93+
return inactiveTintColor
94+
}
95+
8596
var filteredItems: [TabInfo] {
8697
items.filter {
8798
!$0.hidden || $0.key == selectedPage

packages/react-native-bottom-tabs/src/TabView.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ interface Props<Route extends BaseRoute> {
7777
tabBarActiveTintColor?: ColorValue;
7878
/**
7979
* Inactive tab color.
80+
* Has no effect on iOS 26 and above (Liquid Glass).
8081
*/
8182
tabBarInactiveTintColor?: ColorValue;
8283
/**

0 commit comments

Comments
 (0)