Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, weak, nullable) RNSStackScreenHeaderCoordinator *headerCoordinator;

- (void)resetProps;
- (void)didAttachToScreen;

@end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ @implementation RNSStackHeaderConfigComponentView {
RNSStackHeaderConfigShadowStateProxy *_Nonnull _shadowStateProxy;
RNSStackHeaderConfigEventEmitter *_Nonnull _reactEventEmitter;
NSMutableArray<id> *_children;
BOOL _hasAttachedToWindow;
BOOL _hasBuiltHeader;
}

- (instancetype)initWithFrame:(CGRect)frame
Expand Down Expand Up @@ -165,18 +165,26 @@ - (void)didMoveToWindow
{
if (self.window != nil) {
[[self requireNavigationController] setNavigationBarFrameChangeDelegate:self];
if (_hasAttachedToWindow) {
// UIKit is already transitioning the retained screen's bar items. Replacing
// them on reattachment starts a second layout inside the moving glass.
if (_hasBuiltHeader) {
// UIKit is already transitioning the screen's bar items. Replacing them
// when the screen enters the window starts a second layout inside the moving glass.
[self.headerCoordinator applyConfigProperties];
} else {
[self.headerCoordinator rebuild];
_hasAttachedToWindow = YES;
_hasBuiltHeader = YES;
}
}
[super didMoveToWindow];
}

- (void)didAttachToScreen
{
// The screen is pushed before this view reaches a window. Building only on window attach
// starts the push with an empty bar, then moves search and items in mid-transition.
[self.headerCoordinator rebuild];
_hasBuiltHeader = YES;
}

#pragma mark - Child mounting

- (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,9 @@ - (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childCompone
_controller.headerCoordinator.imageLoader = _headerConfig.imageLoader;
}
[super mountChildComponentView:childComponentView index:index];
if (childComponentView == _headerConfig) {
[_headerConfig didAttachToScreen];
}
}

- (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-screens",
"version": "5.0.0-t3.62",
"version": "5.0.0-t3.63",
"description": "Native navigation primitives for your React Native app.",
"scripts": {
"submodules": "git submodule update --init --recursive && (cd react-navigation && yarn && yarn build && cd ../)",
Expand Down