Skip to content

Commit 3c04ce7

Browse files
authored
Remove RNTester's bottom padding under the iPad's floating tab bar
## Summary: On iPad a floating tab bar along the top replaces the bottom tab bar. RNTester's tabs still counted the replaced bar as a bottom bar, because it is not hidden and keeps a full-width frame at the bottom edge (`{{0, 1312}, {1032, 64}}` on an iPad Pro 13-inch). The content got the 65-point bottom inset meant to clear a bottom bar, which example pages use as bottom padding, so each ended with 65 points of empty space. The home list is unaffected either way: its footer is at least 80 points tall. The replaced bar is not in a window, so this change counts a tab bar as a bottom bar only when it is in one. With no bottom bar the bottom inset is 0, not the iPad's 20-point bottom safe area, as it already is for the iPhone Duo's side tab bar. The top inset also leaves the bottom-bar branch, so it loses that branch's 50-point minimum. ## Changelog: [INTERNAL] [FIXED] - Remove the bottom padding from RNTester's content on iPad ## Test Plan: RNTester builds (Xcode 27.1). Run in Debug on an iPad Pro 13-inch (M5) and an iPhone 18 Pro simulator (iOS 27.0). A local UI test measures how far the Button example page's lowest text, scrolled to the end, sits above the bottom of the window: - iPad: 158 points on `main`, 93 on this branch. - iPhone: 176 points on both. Its tab bar is a bottom bar, and the content still ends above it. The home list's last row is at y = 1291 in a 1376-point window on both builds, so the change of top inset does not move the layout. A local log in `tabSafeAreaInsetsDidChange` shows the iPad's `tabBar.window` is nil in every call. Differential Revision: D135070384 Pull Request resolved: #60370
1 parent e72be4b commit 3c04ce7

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎packages/rn-tester/RNTesterTabsIOS/ios/RNTesterTabsIOSComponentView.mm‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,9 @@ - (void)tabSafeAreaInsetsDidChange:(UIEdgeInsets)insets
217217
{
218218
CGRect tabBarFrame = _tabBarController.tabBar.frame;
219219
CGRect bounds = _tabBarController.view.bounds;
220-
BOOL hasBottomTabBar = !_tabBarController.tabBar.hidden && CGRectGetWidth(tabBarFrame) >= CGRectGetWidth(bounds) &&
221-
CGRectGetMaxY(tabBarFrame) >= CGRectGetMaxY(bounds);
220+
// Where a floating tab bar along the top replaces it, as on iPad, the tab bar has no window.
221+
BOOL hasBottomTabBar = _tabBarController.tabBar.window != nil && !_tabBarController.tabBar.hidden &&
222+
CGRectGetWidth(tabBarFrame) >= CGRectGetWidth(bounds) && CGRectGetMaxY(tabBarFrame) >= CGRectGetMaxY(bounds);
222223
if (hasBottomTabBar) {
223224
insets.top = MAX(insets.top, LegacyTopInset);
224225
// Never go below the system inset: anything less leaves content under the tab bar, where taps switch tabs.

0 commit comments

Comments
 (0)