Skip to content

Commit 9ea9def

Browse files
committed
reuse existing UIWindow for RCTDevLoadingView
1 parent 79b09ce commit 9ea9def

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,11 @@ - (void)showMessage:(NSString *)message color:(UIColor *)color backgroundColor:(
113113
self->_showDate = [NSDate date];
114114

115115
UIWindow *mainWindow = RCTKeyWindow();
116-
self->_window = [[UIWindow alloc] initWithWindowScene:mainWindow.windowScene];
117-
self->_window.windowLevel = UIWindowLevelStatusBar + 1;
118-
self->_window.rootViewController = [UIViewController new];
116+
if (!self->_window) {
117+
self->_window = [[UIWindow alloc] initWithWindowScene:mainWindow.windowScene];
118+
self->_window.windowLevel = UIWindowLevelStatusBar + 1;
119+
self->_window.rootViewController = [UIViewController new];
120+
}
119121

120122
self->_container = [[UIView alloc] init];
121123
self->_container.backgroundColor = backgroundColor;

0 commit comments

Comments
 (0)