Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(iOS): activityState regression check false-positive #2404

Merged
merged 2 commits into from
Oct 15, 2024
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
18 changes: 14 additions & 4 deletions ios/RNSScreen.mm
Original file line number Diff line number Diff line change
Expand Up @@ -304,15 +304,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
{
Expand Down
2 changes: 1 addition & 1 deletion ios/RNSScreenStack.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}

Expand Down
Loading