diff --git a/React/CoreModules/RCTRedBox.mm b/React/CoreModules/RCTRedBox.mm index 284b0ff0c87834..93ddf21a255a7d 100644 --- a/React/CoreModules/RCTRedBox.mm +++ b/React/CoreModules/RCTRedBox.mm @@ -235,10 +235,11 @@ - (void)showErrorMessage:(NSString *)message // Remove ANSI color codes from the message NSString *messageWithoutAnsi = [self stripAnsi:message]; + BOOL isRootViewControllerPresented = self.rootViewController.presentingViewController != nil; // Show if this is a new message, or if we're updating the previous message - BOOL isNew = !self.rootViewController.isBeingPresented && !isUpdate; + BOOL isNew = !isRootViewControllerPresented && !isUpdate; BOOL isUpdateForSameMessage = !isNew && - (self.rootViewController.isBeingPresented && isUpdate && + (isRootViewControllerPresented && isUpdate && ((errorCookie == -1 && [_lastErrorMessage isEqualToString:messageWithoutAnsi]) || (errorCookie == _lastErrorCookie))); if (isNew || isUpdateForSameMessage) { @@ -250,7 +251,7 @@ - (void)showErrorMessage:(NSString *)message [_stackTraceTableView reloadData]; - if (!self.rootViewController.isBeingPresented) { + if (!isRootViewControllerPresented) { [_stackTraceTableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:NO];