diff --git a/ios/RNSScreen.mm b/ios/RNSScreen.mm index 309a338f6..4c4619422 100644 --- a/ios/RNSScreen.mm +++ b/ios/RNSScreen.mm @@ -307,15 +307,25 @@ - (void)setActivityStateOrNil:(NSNumber *)activityStateOrNil { int activityState = [activityStateOrNil intValue]; if (activityStateOrNil != nil && activityState != -1 && activityState != _activityState) { - if ([_controller.navigationController isKindOfClass:RNSNavigationController.class] && - _activityState < activityState) { - RCTLogError(@"[RNScreens] activityState can only progress in NativeStack"); - } + [self maybeAssertActivityStateProgressionOldValue:_activityState newValue:activityState]; _activityState = activityState; [_reactSuperview markChildUpdated]; } } +- (void)maybeAssertActivityStateProgressionOldValue:(int)oldValue newValue:(int)newValue +{ + if (self.isNativeStackScreen && newValue < oldValue) { + RCTLogError(@"[RNScreens] activityState can only progress in NativeStack"); + } +} + +/// Note that this method works only after the screen is actually mounted under a screen stack view. +- (BOOL)isNativeStackScreen +{ + return [_reactSuperview isKindOfClass:RNSScreenStackView.class]; +} + #if !TARGET_OS_TV && !TARGET_OS_VISION - (void)setStatusBarStyle:(RNSStatusBarStyle)statusBarStyle { diff --git a/ios/RNSScreenStack.mm b/ios/RNSScreenStack.mm index 98903d176..8fa4fbb7b 100644 --- a/ios/RNSScreenStack.mm +++ b/ios/RNSScreenStack.mm @@ -953,7 +953,7 @@ - (void)navigationController:(UINavigationController *)navigationController - (void)markChildUpdated { - // do nothing + // In native stack this should be called only for `preload` purposes. [self updateContainer]; }