Skip to content

Commit 60e72d7

Browse files
committed
fix: RCTAlertController transparent background override
1 parent d5ff615 commit 60e72d7

2 files changed

Lines changed: 144 additions & 125 deletions

File tree

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,20 @@
99

1010
#import <React/RCTAlertController.h>
1111

12+
#if TARGET_OS_VISION
13+
@interface TransparentViewController : UIViewController
14+
15+
@end
16+
17+
@implementation TransparentViewController
18+
19+
- (UIContainerBackgroundStyle)preferredContainerBackgroundStyle {
20+
return UIContainerBackgroundStyleHidden;
21+
}
22+
23+
@end
24+
#endif
25+
1226
@interface RCTAlertController ()
1327

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

2539
if (_alertWindow) {
40+
#if TARGET_OS_VISION
41+
_alertWindow.rootViewController = [TransparentViewController new];
42+
#else
2643
_alertWindow.rootViewController = [UIViewController new];
44+
#endif
2745
_alertWindow.windowLevel = UIWindowLevelAlert + 1;
2846
}
2947
}

0 commit comments

Comments
 (0)