From f98006830cfb80484903dcd72d5e5e5ca41b9bfa Mon Sep 17 00:00:00 2001 From: Fabrizio Cucci Date: Thu, 10 Oct 2024 10:59:58 -0700 Subject: [PATCH] Replace React.AbstractComponent with `component` type in ProgressBarAndroid.android.js (#46928) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/46928 Prepare for the ref-as-prop typing change in flow. Changelog: [Internal] Reviewed By: SamChou19815 Differential Revision: D64113211 fbshipit-source-id: f850739f9116cf0cc8705e541a97333aa04c3a44 --- .../ProgressBarAndroid.android.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/react-native/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js b/packages/react-native/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js index dd18cc4d2dc..ca5c4fb6a05 100644 --- a/packages/react-native/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js +++ b/packages/react-native/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js @@ -78,7 +78,12 @@ export type ProgressBarAndroidProps = $ReadOnly<{| * }, * ``` */ -const ProgressBarAndroid = ( +const ProgressBarAndroidWithForwardedRef: component( + ref: React.RefSetter< + React.ElementRef, + >, + ...props: ProgressBarAndroidProps +) = React.forwardRef(function ProgressBarAndroid( { // $FlowFixMe[incompatible-type] styleAttr = 'Normal', @@ -89,7 +94,7 @@ const ProgressBarAndroid = ( forwardedRef: ?React.RefSetter< React.ElementRef, >, -) => { +) { return ( ); -}; - -const ProgressBarAndroidToExport = React.forwardRef(ProgressBarAndroid); +}); module.exports = /* $FlowFixMe(>=0.89.0 site=react_native_android_fb) This comment suppresses an * error found when Flow v0.89 was deployed. To see the error, delete this * comment and run Flow. */ - (ProgressBarAndroidToExport: typeof ProgressBarAndroidNativeComponent); + (ProgressBarAndroidWithForwardedRef: typeof ProgressBarAndroidNativeComponent);