Skip to content

Commit 3ebf897

Browse files
authored
fix: Properly dismiss RCTDevLoadingView (#2211)
1 parent bb56537 commit 3ebf897

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ - (void)showMessage:(NSString *)message color:(RCTUIColor *)color backgroundColo
142142
styleMask:NSWindowStyleMaskBorderless
143143
backing:NSBackingStoreBuffered
144144
defer:YES];
145-
self->_window.releasedWhenClosed = NO;
146145
self->_window.backgroundColor = [NSColor clearColor];
147146

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

171171
self->_label.backgroundColor = backgroundColor;
172-
[RCTKeyWindow() beginSheet:self->_window completionHandler:nil];
172+
if (![[RCTKeyWindow() sheets] doesContain:self->_window]) {
173+
[RCTKeyWindow() beginSheet:self->_window completionHandler:^(NSModalResponse returnCode) {
174+
[self->_window orderOut:self];
175+
}];
176+
}
173177
#endif // macOS]
174178
});
175179

0 commit comments

Comments
 (0)