Skip to content

Commit 9fe169e

Browse files
committed
Fix PoC; comments; typos
1 parent e5b0988 commit 9fe169e

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

ios/RNSScreen.mm

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff 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
}

ios/RNSScreenStackHeaderConfig.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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 {

0 commit comments

Comments
 (0)