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
This commit is contained in:
Kevin Gozali
2024-09-14 20:20:34 -07:00
committed by Facebook GitHub Bot
parent afb40e9f2a
commit 7d621f5eb7
@@ -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,
});