Skip to content

Commit

Permalink
fix: Properly dismiss RCTDevLoadingView
Browse files Browse the repository at this point in the history
  • Loading branch information
Saadnajmi committed Oct 3, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 6a74406 commit 5e2ea59
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/react-native/React/CoreModules/RCTDevLoadingView.mm
Original file line number Diff line number Diff line change
@@ -142,10 +142,10 @@ - (void)showMessage:(NSString *)message color:(RCTUIColor *)color backgroundColo
styleMask:NSWindowStyleMaskBorderless
backing:NSBackingStoreBuffered
defer:YES];
self->_window.releasedWhenClosed = NO;
self->_window.backgroundColor = [NSColor clearColor];

NSTextField *label = [[NSTextField alloc] initWithFrame:self->_window.contentView.bounds];
label.font = [NSFont monospacedDigitSystemFontOfSize:12.0 weight:NSFontWeightRegular];
label.alignment = NSTextAlignmentCenter;
label.bezeled = NO;
label.editable = NO;
@@ -169,7 +169,11 @@ - (void)showMessage:(NSString *)message color:(RCTUIColor *)color backgroundColo
self->_label.textColor = color;

self->_label.backgroundColor = backgroundColor;
[RCTKeyWindow() beginSheet:self->_window completionHandler:nil];
if (![[RCTKeyWindow() sheets] doesContain:self->_window]) {
[RCTKeyWindow() beginSheet:self->_window completionHandler:^(NSModalResponse returnCode) {
[self->_window orderOut:self];
}];
}
#endif // macOS]
});

0 comments on commit 5e2ea59

Please sign in to comment.