From 46a9711454b0789c587ba4b6fc0b6bed623a6be0 Mon Sep 17 00:00:00 2001 From: Fabrizio Cucci Date: Thu, 10 Oct 2024 05:21:53 -0700 Subject: [PATCH] Replace React.AbstractComponent with `component` type in SafeAreaView (#46913) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/46913 Prepare for the ref-as-prop typing change in flow. Changelog: [Internal] Reviewed By: SamChou19815 Differential Revision: D64104922 fbshipit-source-id: 3210b6b7368872f13f9006bb1b19de9f92aa4bc8 --- .../Libraries/Components/SafeAreaView/SafeAreaView.js | 8 ++++---- .../__tests__/__snapshots__/public-api-test.js.snap | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/react-native/Libraries/Components/SafeAreaView/SafeAreaView.js b/packages/react-native/Libraries/Components/SafeAreaView/SafeAreaView.js index a154c827511f34..e3da1d7798c42d 100644 --- a/packages/react-native/Libraries/Components/SafeAreaView/SafeAreaView.js +++ b/packages/react-native/Libraries/Components/SafeAreaView/SafeAreaView.js @@ -23,10 +23,10 @@ import * as React from 'react'; * limitation of the screen, such as rounded corners or camera notches (aka * sensor housing area on iPhone X). */ -const exported: React.AbstractComponent< - ViewProps, - React.ElementRef, -> = Platform.select({ +const exported: component( + ref: React.RefSetter>, + ...props: ViewProps +) = Platform.select({ ios: require('./RCTSafeAreaViewNativeComponent').default, default: View, }); diff --git a/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap b/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap index 8c0753fc380ee7..77f78faaf785bc 100644 --- a/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap +++ b/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap @@ -1995,10 +1995,10 @@ declare export default typeof RCTSafeAreaViewNativeComponent; `; exports[`public API should not change unintentionally Libraries/Components/SafeAreaView/SafeAreaView.js 1`] = ` -"declare const exported: React.AbstractComponent< - ViewProps, - React.ElementRef, ->; +"declare const exported: component( + ref: React.RefSetter>, + ...props: ViewProps +); declare export default typeof exported; " `;