diff --git a/ios/platform/Platform_iOS.mm b/ios/platform/Platform_iOS.mm index 55bc3742..d2b139f6 100644 --- a/ios/platform/Platform_iOS.mm +++ b/ios/platform/Platform_iOS.mm @@ -173,17 +173,17 @@ - (void)setStatusBarHidden:(bool)isHidden { } - (void)setRootViewBackgroundColor:(std::string)color alpha:(float)alpha { - UIViewController *presentedViewController = RCTPresentedViewController(); - NSString *colorString = [NSString stringWithUTF8String:color.c_str()]; - UIColor *backgroundColor = colorFromHexString(colorString, alpha); - - if (backgroundColor == nil) { - NSLog(@"🦄 Unistyles: Couldn't set rootView to %@ color", colorString); + dispatch_async(dispatch_get_main_queue(), ^{ + UIViewController *presentedViewController = RCTPresentedViewController(); + NSString *colorString = [NSString stringWithUTF8String:color.c_str()]; + UIColor *backgroundColor = colorFromHexString(colorString, alpha); - return; - } + if (backgroundColor == nil) { + NSLog(@"🦄 Unistyles: Couldn't set rootView to %@ color", colorString); - dispatch_async(dispatch_get_main_queue(), ^{ + return; + } + presentedViewController.view.backgroundColor = backgroundColor; }); }