Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion patches/react-native-screens/details.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@

### [react-native-screens+4.28.0+007+tab-bar-item-selection-hidden.patch](react-native-screens+4.28.0+007+tab-bar-item-selection-hidden.patch)

- Reason: Adds an iOS `tabBarItemSelectionHidden` prop to `Tabs.Host` that hides the iOS 26 liquid glass selection, which UIKit offers no API for. On Android the selected tab shows neither a bold label nor its selected icon while the active indicator is transparent. Used for Account, which has no bar item with the Insights beta (React Navigation patch 005). Leaving that state for another tab does not show the selection on the hidden tab first: on iOS the selection is shown again only after the tab switch, which runs without animation, and on Android the hidden tab keeps a transparent active indicator until it is selected again, so it does not fade out in the color of the new tab, which the shared indicator color takes on.
- Reason: Adds an iOS `tabBarItemSelectionHidden` prop to `Tabs.Host` that hides the iOS 26 liquid glass selection, which UIKit offers no API for. On Android the selected tab shows neither a bold label nor its selected icon while the active indicator is transparent. Used for Account, which has no bar item with the Insights beta (React Navigation patch 005). Leaving that state for another tab does not show the selection on the hidden tab first: on iOS the selection is shown again only after the tab switch, which runs without animation, and on Android the hidden tab keeps a transparent active indicator until it is selected again, so it does not fade out in the color of the new tab, which the shared indicator color takes on. On a foldable iPhone UIKit draws the tab bar items in a floating bar beside the tab bar and moves the selection views into it, so the patch searches the whole tab bar controller view, skipping the selected tab's content view, rather than the tab bar alone.
- Upstream PR/issue: not reported, because the iOS part hides private UIKit views by class name, which RNScreens would not take as is.
- E/App issue: [#104197](https://github.com/Expensify/App/issues/104197), [#105025](https://github.com/Expensify/App/issues/105025)
- PR introducing patch: [#104491](https://github.com/Expensify/App/pull/104491)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ index d76842a..bc62e29 100644
* Tell the controller that react provided tabs have changed (count / instances) & the child
* view controllers need to be updated.
diff --git a/node_modules/react-native-screens/ios/tabs/host/RNSTabBarController.mm b/node_modules/react-native-screens/ios/tabs/host/RNSTabBarController.mm
index 06c1957..3c2acf0 100644
index 06c1957..2be6a93 100644
--- a/node_modules/react-native-screens/ios/tabs/host/RNSTabBarController.mm
+++ b/node_modules/react-native-screens/ios/tabs/host/RNSTabBarController.mm
@@ -86,6 +86,9 @@ @implementation RNSTabBarController {
@@ -86,6 +86,9 @@ static void rns_pushViewController(__unsafe_unretained id self,
/// delegate handling). Setter overrides skip reconciliation while this flag is set.
BOOL _isHandlingExplicitSelectionUpdate;

Expand All @@ -149,15 +149,15 @@ index 06c1957..3c2acf0 100644
RNSTabsNavigationStateObserverRegistry *_observerRegistry;

RNSParentContainerItemRegistry *_Nonnull _parentContainerRegistry;
@@ -177,6 +180,40 @@ - (void)detachFromParentContainerItem
@@ -177,6 +180,46 @@ static void rns_pushViewController(__unsafe_unretained id self,

#pragma mark - UIKit callbacks

+- (void)viewDidLayoutSubviews
+{
+ [super viewDidLayoutSubviews];
+ if (_tabBarItemSelectionHidden) {
+ [self updateTabBarItemSelectionIn:self.tabBar];
+ [self updateTabBarItemSelectionIn:self.view];
+ }
+}
+
Expand All @@ -170,13 +170,19 @@ index 06c1957..3c2acf0 100644
+ }
+ _isSelectionRevealDeferred = NO;
+ _tabBarItemSelectionHidden = tabBarItemSelectionHidden;
+ [self updateTabBarItemSelectionIn:self.tabBar];
+ [self updateTabBarItemSelectionIn:self.view];
+}
+
+// Private views that draw the iOS 26 liquid glass selection.
+// Private views that draw the iOS 26 liquid glass selection. A foldable iPhone draws the tab bar items in a floating bar
+// next to `self.tabBar`, and UIKit moves these views between the two, so the whole container is searched, except the
+// selected tab's content.
+- (void)updateTabBarItemSelectionIn:(UIView *)view
+{
+ UIView *contentView = self.selectedViewController.viewIfLoaded;
+ for (UIView *subview in view.subviews) {
+ if (subview == contentView) {
+ continue;
+ }
+ NSString *className = NSStringFromClass(subview.class);
+ if ([className hasSuffix:@"LiquidLensView"] || [className hasSuffix:@"SelectedContentView"] ||
+ [className hasSuffix:@"DestOutView"]) {
Expand All @@ -190,7 +196,7 @@ index 06c1957..3c2acf0 100644
- (void)didMoveToParentViewController:(UIViewController *)parent
{
[super didMoveToParentViewController:parent];
@@ -276,7 +313,16 @@ - (void)performContainerUpdate
@@ -276,7 +319,16 @@ static void rns_pushViewController(__unsafe_unretained id self,
{
_isHandlingExplicitSelectionUpdate = YES;
[self updateChildViewControllersIfNeeded];
Expand All @@ -208,7 +214,7 @@ index 06c1957..3c2acf0 100644
_isHandlingExplicitSelectionUpdate = NO;

[self updateTabBarAppearanceIfNeeded];
@@ -353,6 +399,11 @@ - (void)userDidRepeatViewControllerSelection:(nonnull UIViewController *)viewCon
@@ -353,6 +405,11 @@ static void rns_pushViewController(__unsafe_unretained id self,

- (void)userDidSelectViewController:(nonnull UIViewController *)viewController
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useSafeAreaInsets from '@hooks/useSafeAreaInsets';

import useIsTabBarVertical from '@libs/Navigation/AppNavigator/Navigators/NativeTabNavigator/useIsTabBarVertical';
import {getFloatingButtonsBottom} from '@libs/Navigation/AppNavigator/Navigators/NativeTabNavigator/useNativeTabBarOptions';

/** The translucent UITabBar and the home indicator inset under it cover the bottom of a narrow tab root screen. */
/**
* The translucent UITabBar and the home indicator inset under it cover the bottom of a narrow tab root screen. A tab bar
* laid out as a column sits beside the content, so only the home indicator inset covers it then.
*/
function useTabBarCoveredHeight(): number {
const {shouldUseNarrowLayout} = useResponsiveLayout();
const {bottom: bottomInset} = useSafeAreaInsets();
const isTabBarVertical = useIsTabBarVertical();

return shouldUseNarrowLayout ? getFloatingButtonsBottom(bottomInset) : 0;
if (!shouldUseNarrowLayout) {
return 0;
}
return isTabBarVertical ? bottomInset : getFloatingButtonsBottom(bottomInset);
Comment thread
war-in marked this conversation as resolved.
Resolved
}

export default useTabBarCoveredHeight;
Loading