From 098c99d53865acde768105fd77936af5cf75208d Mon Sep 17 00:00:00 2001 From: Pieter De Baets Date: Tue, 6 Oct 2026 19:13:00 -0700 Subject: [PATCH] Fix native RNTester tabs in Buck builds Summary: Internal Buck builds did not link the RNTesterTabsIOS component, so React Native rendered the component as an unimplemented placeholder. Link the component and its Fabric plugin into the RNTester Apple target. Keep compact bottom-tab content aligned with the previous RNTester chrome so existing example screenshot bounds remain stable. Changelog: [Internal] Differential Revision: D123770213 --- .../ios/RNTesterTabsIOSComponentView.mm | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/packages/rn-tester/RNTesterTabsIOS/ios/RNTesterTabsIOSComponentView.mm b/packages/rn-tester/RNTesterTabsIOS/ios/RNTesterTabsIOSComponentView.mm index 4bb4f338b39..d169fdcd414 100644 --- a/packages/rn-tester/RNTesterTabsIOS/ios/RNTesterTabsIOSComponentView.mm +++ b/packages/rn-tester/RNTesterTabsIOS/ios/RNTesterTabsIOSComponentView.mm @@ -14,8 +14,18 @@ #import #import +#if __has_include() +#import +#else +#import "RCTFabricComponentsPlugins.h" +#endif + using namespace facebook::react; +// Preserve RNTester's existing example bounds on compact bottom-tab layouts. +static constexpr CGFloat LegacyTopInset = 50; +static constexpr CGFloat LegacyBottomInset = 65; + /** * A tab's view controller, which reports when the tab bar or window changes * the area its content needs to clear. @@ -205,17 +215,20 @@ - (void)updateEventEmitter:(const EventEmitter::Shared &)eventEmitter - (void)tabSafeAreaInsetsDidChange:(UIEdgeInsets)insets { - // The home indicator's inset only applies beneath a tab bar along the bottom edge, which already - // clears it. With the tab bar at the side, content runs to the bottom edge. CGRect tabBarFrame = _tabBarController.tabBar.frame; CGRect bounds = _tabBarController.view.bounds; - if (CGRectGetWidth(tabBarFrame) < CGRectGetWidth(bounds) || CGRectGetMaxY(tabBarFrame) < CGRectGetMaxY(bounds)) { + BOOL hasBottomTabBar = !_tabBarController.tabBar.hidden && CGRectGetWidth(tabBarFrame) >= CGRectGetWidth(bounds) && + CGRectGetMaxY(tabBarFrame) >= CGRectGetMaxY(bounds); + if (hasBottomTabBar) { + insets.top = MAX(insets.top, LegacyTopInset); + insets.bottom = MIN(insets.bottom, LegacyBottomInset); + } else { insets.bottom = 0; - } - // A window with no status bar along the top, such as the iPhone Duo's, reports no top inset. Keep - // content a small distance from the display's rounded top edge. - if (insets.top == 0) { - insets.top = 16; + // A window with no status bar along the top, such as the iPhone Duo's, reports no top inset. Keep + // content a small distance from the display's rounded top edge. + if (insets.top == 0) { + insets.top = 16; + } } if (UIEdgeInsetsEqualToEdgeInsets(insets, _contentInsets) || _eventEmitter == nullptr) { return;