From 7d621f5eb761cd71e6ef593b289d0f35bdd1560b Mon Sep 17 00:00:00 2001 From: Kevin Gozali Date: Sat, 14 Sep 2024 20:20:34 -0700 Subject: [PATCH] Android: check SafeAreaView component existence before exporting (#46500) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/46500 We're in the process of adding the required native component to all apps we maintain. Until that is fully completed, fall back to using View if the native component doesn't exist. Changelog: [Internal] Reviewed By: shwanton Differential Revision: D62701331 fbshipit-source-id: d26c946af3a68231d0714e89d5e41be311399036 --- .../components/SafeAreaView_INTERNAL_DO_NOT_USE.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/react-native/src/private/components/SafeAreaView_INTERNAL_DO_NOT_USE.js b/packages/react-native/src/private/components/SafeAreaView_INTERNAL_DO_NOT_USE.js index 3cf238fa81c..a3324550c81 100644 --- a/packages/react-native/src/private/components/SafeAreaView_INTERNAL_DO_NOT_USE.js +++ b/packages/react-native/src/private/components/SafeAreaView_INTERNAL_DO_NOT_USE.js @@ -12,6 +12,7 @@ import type {ViewProps} from '../../../Libraries/Components/View/ViewPropTypes'; import Platform from '../../../Libraries/Utilities/Platform'; import View from '../../../Libraries/Components/View/View'; +import UIManager from '../../../Libraries/ReactNative/UIManager'; import * as React from 'react'; const exported: React.AbstractComponent< @@ -20,9 +21,10 @@ const exported: React.AbstractComponent< > = Platform.select({ ios: require('../../../src/private/specs/components/RCTSafeAreaViewNativeComponent') .default, - android: - require('../../../src/private/specs/components/RCTSafeAreaViewNativeComponent') - .default, + android: UIManager.hasViewManagerConfig('RCTSafeAreaView') + ? require('../../../src/private/specs/components/RCTSafeAreaViewNativeComponent') + .default + : View, default: View, });