Skip to content

Commit cb1f8ed

Browse files
committed
fix: dismiss redbox only if presented
1 parent d8bc0e2 commit cb1f8ed

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/react-native/React/CoreModules/RCTRedBox.mm

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,8 +418,10 @@ - (void)dismiss
418418
{
419419
#if !TARGET_OS_OSX // [macOS]
420420
[self dismissViewControllerAnimated:YES completion:nil];
421-
#else // [macOS
422-
[[RCTKeyWindow() contentViewController] dismissViewController:self];
421+
#else // [macOS]
422+
if (self.presentingViewController) {
423+
[[RCTKeyWindow() contentViewController] dismissViewController:self];
424+
}
423425
#endif // macOS]
424426
}
425427

0 commit comments

Comments
 (0)