Skip to content

Commit

Permalink
fix: RCTAlertController transparent background override
Browse files Browse the repository at this point in the history
  • Loading branch information
okwasniewski committed Jan 8, 2024
1 parent d5ff615 commit 60e72d7
Show file tree
Hide file tree
Showing 2 changed files with 144 additions and 125 deletions.
18 changes: 18 additions & 0 deletions packages/react-native/React/CoreModules/RCTAlertController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,20 @@

#import <React/RCTAlertController.h>

#if TARGET_OS_VISION
@interface TransparentViewController : UIViewController

@end

@implementation TransparentViewController

- (UIContainerBackgroundStyle)preferredContainerBackgroundStyle {
return UIContainerBackgroundStyleHidden;
}

@end
#endif

@interface RCTAlertController ()

@property (nonatomic, strong) UIWindow *alertWindow;
Expand All @@ -23,7 +37,11 @@ - (UIWindow *)alertWindow
_alertWindow = [[UIWindow alloc] initWithWindowScene:RCTKeyWindow().windowScene];

if (_alertWindow) {
#if TARGET_OS_VISION
_alertWindow.rootViewController = [TransparentViewController new];
#else
_alertWindow.rootViewController = [UIViewController new];
#endif
_alertWindow.windowLevel = UIWindowLevelAlert + 1;
}
}
Expand Down
Loading

0 comments on commit 60e72d7

Please sign in to comment.