|
22 | 22 |
|
23 | 23 | using namespace facebook::react; |
24 | 24 |
|
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 | | - |
29 | 25 | /** |
30 | 26 | * A tab's view controller, which reports when the tab bar or window changes |
31 | 27 | * the area its content needs to clear. |
@@ -215,20 +211,17 @@ - (void)updateEventEmitter:(const EventEmitter::Shared &)eventEmitter |
215 | 211 |
|
216 | 212 | - (void)tabSafeAreaInsetsDidChange:(UIEdgeInsets)insets |
217 | 213 | { |
| 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. |
218 | 216 | CGRect tabBarFrame = _tabBarController.tabBar.frame; |
219 | 217 | 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)) { |
226 | 219 | 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; |
232 | 225 | } |
233 | 226 | if (UIEdgeInsetsEqualToEdgeInsets(insets, _contentInsets) || _eventEmitter == nullptr) { |
234 | 227 | return; |
|
0 commit comments