Skip to content
Closed
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
1 change: 1 addition & 0 deletions ios/RNSScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ namespace react = facebook::react;
- (void)calculateAndNotifyHeaderHeightChangeIsModal:(BOOL)isModal;
- (void)notifyFinishTransitioning;
- (RNSScreenView *)screenView;
@property (nonatomic, readonly) BOOL disappeared;
#ifdef RCT_NEW_ARCH_ENABLED
- (void)setViewToSnapshot;
- (CGFloat)calculateHeaderHeightIsModal:(BOOL)isModal;
Expand Down
5 changes: 5 additions & 0 deletions ios/RNSScreen.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1383,6 +1383,7 @@ - (instancetype)initWithView:(UIView *)view
self.view = view;
_fakeView = [UIView new];
_shouldNotify = YES;
_disappeared = NO;
#ifdef RCT_NEW_ARCH_ENABLED
_initialView = (RNSScreenView *)view;
#endif
Expand All @@ -1394,6 +1395,7 @@ - (instancetype)initWithView:(UIView *)view
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
_disappeared = NO;
if (!_isSwiping) {
[self.screenView notifyWillAppear];
if (self.transitionCoordinator.isInteractive) {
Expand Down Expand Up @@ -1421,6 +1423,7 @@ - (void)viewWillAppear:(BOOL)animated
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
_disappeared = NO;
// self.navigationController might be null when we are dismissing a modal
if (!self.transitionCoordinator.isInteractive && self.navigationController != nil) {
// user might have long pressed ios 14 back button item,
Expand Down Expand Up @@ -1458,6 +1461,7 @@ - (void)viewWillDisappear:(BOOL)animated
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
_disappeared = NO;
if (!_isSwiping || _shouldNotify) {
// we are going forward or dismissing without swipe
// or successfully swiped back
Expand All @@ -1474,6 +1478,7 @@ - (void)viewDidAppear:(BOOL)animated
- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
_disappeared = YES;
if (self.parentViewController == nil && self.presentingViewController == nil) {
if (self.screenView.preventNativeDismiss) {
// if we want to prevent the native dismiss, we do not send dismissal event,
Expand Down
11 changes: 10 additions & 1 deletion ios/RNSScreenStack.mm
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,16 @@ - (void)setPushViewControllers:(NSArray<UIViewController *> *)controllers
[newControllers removeLastObject];

[_controller setViewControllers:newControllers animated:NO];
[_controller pushViewController:top animated:YES];

// If entered waiting transition complete logic
// the `updateContainer` is async calling
// top controller may not a new one
// but old one between disappeared and unmounted
// which not in _controllers, but _reactSubviews not remove it yet
// should not push it
if(!((RNSScreen *)top).disappeared) {
[_controller pushViewController:top animated:YES];
}
} else {
// don't really know what this case could be, but may need to handle it
// somehow
Expand Down