Skip to content

Commit

Permalink
fix: Properly dismiss RCTDevLoadingView (#2213)
Browse files Browse the repository at this point in the history
  • Loading branch information
Saadnajmi authored Oct 3, 2024
1 parent 6a74406 commit d267a0a
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
Expand Up @@ -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;
Expand All @@ -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]
});

Expand Down

0 comments on commit d267a0a

Please sign in to comment.