diff --git a/packages/react-native/Libraries/Components/SafeAreaView/SafeAreaView.d.ts b/packages/react-native/Libraries/Components/SafeAreaView/SafeAreaView.d.ts index f96a1a50753..6fa77f5f3c5 100644 --- a/packages/react-native/Libraries/Components/SafeAreaView/SafeAreaView.d.ts +++ b/packages/react-native/Libraries/Components/SafeAreaView/SafeAreaView.d.ts @@ -13,12 +13,21 @@ import {NativeMethods} from '../../../types/public/ReactNativeTypes'; import {ViewProps} from '../View/ViewPropTypes'; /** + * @deprecated + * Use `react-native-safe-area-context` instead. This component is deprecated and will be removed in a future release. + * * Renders nested content and automatically applies paddings reflect the portion of the view * that is not covered by navigation bars, tab bars, toolbars, and other ancestor views. * Moreover, and most importantly, Safe Area's paddings reflect physical limitation of the screen, * such as rounded corners or camera notches (aka sensor housing area on iPhone X). */ declare class SafeAreaViewComponent extends React.Component {} + declare const SafeAreaViewBase: Constructor & typeof SafeAreaViewComponent; + +/** + * @deprecated + * Use `react-native-safe-area-context` instead. This component is deprecated and will be removed in a future release. + */ export class SafeAreaView extends SafeAreaViewBase {} diff --git a/packages/react-native/Libraries/Components/SafeAreaView/SafeAreaView.js b/packages/react-native/Libraries/Components/SafeAreaView/SafeAreaView.js index 290fdbd0e06..bee10606e30 100644 --- a/packages/react-native/Libraries/Components/SafeAreaView/SafeAreaView.js +++ b/packages/react-native/Libraries/Components/SafeAreaView/SafeAreaView.js @@ -22,6 +22,7 @@ import * as React from 'react'; * Moreover, and most importantly, Safe Area's paddings reflect physical * limitation of the screen, such as rounded corners or camera notches (aka * sensor housing area on iPhone X). + * @deprecated Use `react-native-safe-area-context` instead. This component will be removed in a future release. */ const exported: component( ref?: React.RefSetter>, diff --git a/packages/react-native/index.js b/packages/react-native/index.js index 1b8b97682b8..0f4d1c8278d 100644 --- a/packages/react-native/index.js +++ b/packages/react-native/index.js @@ -83,7 +83,18 @@ module.exports = { return require('./Libraries/Components/RefreshControl/RefreshControl') .default; }, + /** + * @deprecated SafeAreaView has been deprecated and will be removed in a future release. + * Please use 'react-native-safe-area-context' instead. + * See https://github.com/th3rdwave/react-native-safe-area-context + */ get SafeAreaView() { + warnOnce( + 'safe-area-view-deprecated', + 'SafeAreaView has been deprecated and will be removed in a future release. ' + + "Please use 'react-native-safe-area-context' instead. " + + 'See https://github.com/th3rdwave/react-native-safe-area-context', + ); return require('./Libraries/Components/SafeAreaView/SafeAreaView').default; }, get ScrollView() {