From d5fab0b5d3e06d066ed288d68f7385e72ea67ad8 Mon Sep 17 00:00:00 2001 From: Janic Duplessis Date: Tue, 15 Feb 2022 23:53:05 -0500 Subject: [PATCH] Fix app extension support by using RCTKeyWindow --- ios/SafeAreaView/RNCSafeAreaProviderManager.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ios/SafeAreaView/RNCSafeAreaProviderManager.m b/ios/SafeAreaView/RNCSafeAreaProviderManager.m index 3a8ca35c..5c0fd945 100644 --- a/ios/SafeAreaView/RNCSafeAreaProviderManager.m +++ b/ios/SafeAreaView/RNCSafeAreaProviderManager.m @@ -20,8 +20,10 @@ - (UIView *)view - (NSDictionary *)constantsToExport { - UIWindow *window = [[UIApplication sharedApplication] keyWindow]; - if (@available(iOS 11.0, *)) { + UIWindow *window = RCTKeyWindow(); + if (window == nil) { + return @{@"initialWindowMetrics" : [NSNull null]}; + } else if (@available(iOS 11.0, *)) { UIEdgeInsets safeAreaInsets = window.safeAreaInsets; return @{ @"initialWindowMetrics" : @{