Replace React.AbstractComponent with component type in ScrollView (#46927)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46927

Prepare for the ref-as-prop typing change in flow.

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D64112934

fbshipit-source-id: d869ccd814cd3bbda2a548c7c2d405f651605716
This commit is contained in:
Fabrizio Cucci
2024-10-10 10:59:58 -07:00
committed by Facebook GitHub Bot
parent c8fd793cff
commit c00f0d36b1
2 changed files with 10 additions and 10 deletions
@@ -1935,7 +1935,10 @@ function createRefForwarder<TNativeInstance, TPublicInstance>(
// NOTE: This wrapper component is necessary because `ScrollView` is a class
// component and we need to map `ref` to a differently named prop. This can be
// removed when `ScrollView` is a functional component.
const Wrapper = React.forwardRef(function Wrapper(
const Wrapper: component(
ref: React.RefSetter<PublicScrollViewInstance>,
...props: Props
) = React.forwardRef(function Wrapper(
props: Props,
ref: ?React.RefSetter<PublicScrollViewInstance>,
): React.Node {
@@ -1949,8 +1952,5 @@ Wrapper.displayName = 'ScrollView';
// $FlowExpectedError[prop-missing]
Wrapper.Context = ScrollViewContext;
module.exports = ((Wrapper: $FlowFixMe): React.AbstractComponent<
React.ElementConfig<typeof ScrollView>,
PublicScrollViewInstance,
> &
module.exports = ((Wrapper: $FlowFixMe): typeof Wrapper &
ScrollViewComponentStatics);
@@ -2258,11 +2258,11 @@ type RefForwarder<TNativeInstance, TPublicInstance> = {
nativeInstance: TNativeInstance | null,
publicInstance: TPublicInstance | null,
};
declare module.exports: React.AbstractComponent<
React.ElementConfig<typeof ScrollView>,
PublicScrollViewInstance,
> &
ScrollViewComponentStatics;
declare const Wrapper: component(
ref: React.RefSetter<PublicScrollViewInstance>,
...props: Props
);
declare module.exports: typeof Wrapper & ScrollViewComponentStatics;
"
`;