From f86a14e4adb64c5292785fdf8a381e26ef034eac Mon Sep 17 00:00:00 2001 From: Fabrizio Cucci Date: Thu, 10 Oct 2024 07:01:29 -0700 Subject: [PATCH] Replace React.AbstractComponent with `component` type in View (#46916) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/46916 Prepare for the ref-as-prop typing change in flow. Changelog: [Internal] Reviewed By: SamChou19815 Differential Revision: D64104990 fbshipit-source-id: c747f4e89b5631a6c1543aca86cbea4db4987f5a --- packages/react-native/Libraries/Components/View/View.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/View/View.js b/packages/react-native/Libraries/Components/View/View.js index e51583ca6fe..f1522cf7a85 100644 --- a/packages/react-native/Libraries/Components/View/View.js +++ b/packages/react-native/Libraries/Components/View/View.js @@ -23,10 +23,10 @@ export type Props = ViewProps; * * @see https://reactnative.dev/docs/view */ -const View: React.AbstractComponent< - ViewProps, - React.ElementRef, -> = React.forwardRef( +const View: component( + ref: React.RefSetter>, + ...props: ViewProps +) = React.forwardRef( ( { accessibilityElementsHidden, 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 77f78faaf78..2922e593e7c 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 @@ -3924,10 +3924,10 @@ declare module.exports: ReactNativeViewAttributes; exports[`public API should not change unintentionally Libraries/Components/View/View.js 1`] = ` "export type Props = ViewProps; -declare const View: React.AbstractComponent< - ViewProps, - React.ElementRef, ->; +declare const View: component( + ref: React.RefSetter>, + ...props: ViewProps +); declare module.exports: View; " `;