File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -151,12 +151,19 @@ - (void)updateBounds
151151#ifdef RCT_NEW_ARCH_ENABLED
152152 if (_state != nullptr ) {
153153 RNSScreenStackHeaderConfig *config = [self findHeaderConfig ];
154- // in large title, ScrollView handles the offset of content so we cannot set it here also.
155- CGFloat headerHeight =
156- config.largeTitle ? 0 : [_controller calculateHeaderHeightIsModal: self .isPresentedAsNativeModal];
157- auto newState =
158- react::RNSScreenState{RCTSizeFromCGSize (self.bounds .size ), RCTPointFromCGPoint (CGPointMake (0 , headerHeight))};
154+
155+ // in large title, ScrollView handles the offset of content so we cannot set it here also
156+ // TODO: Why is it assumed in comment above, that large title uses scrollview here? What if only SafeAreView is
157+ // used? When config.translucent, we currently use `edgesForExtendedLayout` and the screen is laid out under the
158+ // navigation bar, therefore there is no need to set content offset in shadow tree.
159+ const CGFloat effectiveContentOffsetY = config.largeTitle || config.translucent
160+ ? 0
161+ : [_controller calculateHeaderHeightIsModal: self .isPresentedAsNativeModal];
162+
163+ auto newState = react::RNSScreenState{RCTSizeFromCGSize (self.bounds .size ), {0 , effectiveContentOffsetY}};
159164 _state->updateState (std::move (newState));
165+
166+ // TODO: Requesting layout on every layout is wrong. We should look for a way to get rid of this.
160167 UINavigationController *navctr = _controller.navigationController ;
161168 [navctr.view setNeedsLayout ];
162169 }
Original file line number Diff line number Diff line change @@ -603,7 +603,7 @@ + (void)updateViewController:(UIViewController *)vc
603603 BOOL shouldHide = config == nil || !config.shouldHeaderBeVisible ;
604604
605605 if (!shouldHide && !config.translucent ) {
606- // when nav bar is not translucent we chage edgesForExtendedLayout to avoid system laying out
606+ // when nav bar is not translucent we change edgesForExtendedLayout to avoid system laying out
607607 // the screen underneath navigation controllers
608608 vc.edgesForExtendedLayout = UIRectEdgeNone;
609609 } else {
You can’t perform that action at this time.
0 commit comments