Skip to content

Commit 20808ee

Browse files
authored
refactor(iOS, Paper): do not add subviews to header config in HostTree (#2553)
## Description I was just writing #2552 and got confused that the header config subviews are added as subviews to the header config view in host tree, before they are attached to the navigation bar view hierarchy. This transient state does not make any sense, and we do not do similar thing on Fabric. ## Changes `self.superview` returns now `nil` until the subview is mounted in navigation bar view hierarchy. Also moved the function to Paper specific section of file, because it is not called on Fabric on any codepath. ## Test code and steps to reproduce We haven't used this behaviour. There should be no regression in text examples. ## Checklist - [ ] Included code example that can be used to test this change - [ ] Updated TS types - [ ] Updated documentation: <!-- For adding new props to native-stack --> - [ ] https://github.com/software-mansion/react-native-screens/blob/main/guides/GUIDE_FOR_LIBRARY_AUTHORS.md - [ ] https://github.com/software-mansion/react-native-screens/blob/main/native-stack/README.md - [ ] https://github.com/software-mansion/react-native-screens/blob/main/src/types.tsx - [ ] https://github.com/software-mansion/react-native-screens/blob/main/src/native-stack/types.tsx - [ ] Ensured that CI passes
1 parent 8c43de6 commit 20808ee

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

ios/RNSScreenStackHeaderConfig.mm

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -828,12 +828,6 @@ - (void)removeReactSubview:(RNSScreenStackHeaderSubview *)subview
828828
}
829829
RNS_IGNORE_SUPER_CALL_BEGIN
830830

831-
- (void)didUpdateReactSubviews
832-
{
833-
[super didUpdateReactSubviews];
834-
[self updateViewControllerIfNeeded];
835-
}
836-
837831
#ifdef RCT_NEW_ARCH_ENABLED
838832
#pragma mark - Fabric specific
839833

@@ -1050,6 +1044,11 @@ - (void)updateState:(const facebook::react::State::Shared &)state
10501044
#else
10511045
#pragma mark - Paper specific
10521046

1047+
- (void)didUpdateReactSubviews
1048+
{
1049+
[self updateViewControllerIfNeeded];
1050+
}
1051+
10531052
- (void)didSetProps:(NSArray<NSString *> *)changedProps
10541053
{
10551054
[super didSetProps:changedProps];

0 commit comments

Comments
 (0)