Skip to content

Commit d9918d8

Browse files
committed
Restore RNTester tab safe area behavior
1 parent 8d8b8f3 commit d9918d8

1 file changed

Lines changed: 8 additions & 15 deletions

File tree

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

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@
2222

2323
using namespace facebook::react;
2424

25-
// Preserve RNTester's existing example bounds on compact bottom-tab layouts.
26-
static constexpr CGFloat LegacyTopInset = 50;
27-
static constexpr CGFloat LegacyBottomInset = 65;
28-
2925
/**
3026
* A tab's view controller, which reports when the tab bar or window changes
3127
* the area its content needs to clear.
@@ -215,20 +211,17 @@ - (void)updateEventEmitter:(const EventEmitter::Shared &)eventEmitter
215211

216212
- (void)tabSafeAreaInsetsDidChange:(UIEdgeInsets)insets
217213
{
214+
// The home indicator's inset only applies beneath a tab bar along the bottom edge, which already
215+
// clears it. With the tab bar at the side, content runs to the bottom edge.
218216
CGRect tabBarFrame = _tabBarController.tabBar.frame;
219217
CGRect bounds = _tabBarController.view.bounds;
220-
BOOL hasBottomTabBar = !_tabBarController.tabBar.hidden && CGRectGetWidth(tabBarFrame) >= CGRectGetWidth(bounds) &&
221-
CGRectGetMaxY(tabBarFrame) >= CGRectGetMaxY(bounds);
222-
if (hasBottomTabBar) {
223-
insets.top = MAX(insets.top, LegacyTopInset);
224-
insets.bottom = MIN(insets.bottom, LegacyBottomInset);
225-
} else {
218+
if (CGRectGetWidth(tabBarFrame) < CGRectGetWidth(bounds) || CGRectGetMaxY(tabBarFrame) < CGRectGetMaxY(bounds)) {
226219
insets.bottom = 0;
227-
// A window with no status bar along the top, such as the iPhone Duo's, reports no top inset. Keep
228-
// content a small distance from the display's rounded top edge.
229-
if (insets.top == 0) {
230-
insets.top = 16;
231-
}
220+
}
221+
// A window with no status bar along the top, such as the iPhone Duo's, reports no top inset. Keep
222+
// content a small distance from the display's rounded top edge.
223+
if (insets.top == 0) {
224+
insets.top = 16;
232225
}
233226
if (UIEdgeInsetsEqualToEdgeInsets(insets, _contentInsets) || _eventEmitter == nullptr) {
234227
return;

0 commit comments

Comments
 (0)