react-native-safe-area-context icon indicating copy to clipboard operation
react-native-safe-area-context copied to clipboard

SafeAreaProvider doesn't render content if the app is launched from CarPlay

Open gaodeng opened this issue 5 years ago • 3 comments

If the app is launched from carplay, the insets here will be null which cause SafeAreaProvider doesn't render content https://github.com/th3rdwave/react-native-safe-area-context/blob/b1824ef84d78a44e91cd156a29abe3da243eee94/src/SafeAreaContext.tsx#L78

gaodeng avatar Aug 01 '20 01:08 gaodeng

Interesting, I'm not familiar with carplay, I assume it doesn't trigger the same layout events as android which means JS never receive inset values.

janicduplessis avatar Aug 19 '20 18:08 janicduplessis

@gaodeng I'd be happy to look at PRs

jacobp100 avatar Jan 19 '23 16:01 jacobp100

Simply returning the children instead of null fixed it for me. Submitted a PR

diff --git a/node_modules/react-native-safe-area-context/src/SafeAreaContext.tsx b/node_modules/react-native-safe-area-context/src/SafeAreaContext.tsx
index 5da007e..6a29480 100644
--- a/node_modules/react-native-safe-area-context/src/SafeAreaContext.tsx
+++ b/node_modules/react-native-safe-area-context/src/SafeAreaContext.tsx
@@ -100,7 +100,7 @@ export function SafeAreaProvider({
             {children}
           </SafeAreaInsetsContext.Provider>
         </SafeAreaFrameContext.Provider>
-      ) : null}
+      ) : children}
     </NativeSafeAreaProvider>
   );
 }

tommynordli avatar Feb 28 '24 13:02 tommynordli