Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null Exception Handling | Input Validation - RCTAlertController - RCTDevLoadingView #35689

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix/naming
  • Loading branch information
admirsaheta committed Dec 21, 2022
commit a7ea7963c870a823479cfba630bb77012c98a00f
16 changes: 8 additions & 8 deletions React/CoreModules/RCTDevLoadingView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -126,19 +126,19 @@ - (void)showMessage:(NSString *)message color:(UIColor *)color backgroundColor:(

dispatch_async(dispatch_get_main_queue(), ^{
self->_showDate = [NSDate date];
if (!self->_uiWindow && !RCTRunningInTestEnvironment()) {
if (!self->_window && !RCTRunningInTestEnvironment()) {
CGSize screenSize = [UIScreen mainScreen].bounds.size;

UIWindow *window = RCTSharedApplication().keyWindow;
self->_uiWindow =
self->_window =
[[UIWindow alloc] initWithFrame:CGRectMake(0, 0, screenSize.width, window.safeAreaInsets.top + 10)];
self->_label =
[[UILabel alloc] initWithFrame:CGRectMake(0, window.safeAreaInsets.top - 10, screenSize.width, 20)];
[self->_uiWindow addSubview:self->_label];
[self->_window addSubview:self->_label];

self->_uiWindow.windowLevel = UIWindowLevelStatusBar + 1;
self->_window.windowLevel = UIWindowLevelStatusBar + 1;
// set a root VC so rotation is supported
self->_uiWindow.rootViewController = [UIViewController new];
self->_window.rootViewController = [UIViewController new];

self->_label.font = [UIFont monospacedDigitSystemFontOfSize:12.0 weight:UIFontWeightRegular];
self->_label.textAlignment = NSTextAlignmentCenter;
Expand All @@ -147,14 +147,14 @@ - (void)showMessage:(NSString *)message color:(UIColor *)color backgroundColor:(
self->_label.text = message;
self->_label.textColor = color;

self->_uiWindow.backgroundColor = backgroundColor;
self->_uiWindow.hidden = NO;
self->_window.backgroundColor = backgroundColor;
self->_window.hidden = NO;

#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \
__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0
if (@available(iOS 13.0, *)) {
UIWindowScene *scene = (UIWindowScene *)RCTSharedApplication().connectedScenes.anyObject;
self->_uiWindow.windowScene = scene;
self->_window.windowScene = scene;
}
#endif
});
Expand Down