Skip to content

Commit d5fab0b

Browse files
Fix app extension support by using RCTKeyWindow
1 parent 684c8a0 commit d5fab0b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ios/SafeAreaView/RNCSafeAreaProviderManager.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ - (UIView *)view
2020

2121
- (NSDictionary *)constantsToExport
2222
{
23-
UIWindow *window = [[UIApplication sharedApplication] keyWindow];
24-
if (@available(iOS 11.0, *)) {
23+
UIWindow *window = RCTKeyWindow();
24+
if (window == nil) {
25+
return @{@"initialWindowMetrics" : [NSNull null]};
26+
} else if (@available(iOS 11.0, *)) {
2527
UIEdgeInsets safeAreaInsets = window.safeAreaInsets;
2628
return @{
2729
@"initialWindowMetrics" : @{

0 commit comments

Comments
 (0)