Skip to content

Commit

Permalink
Replace React.AbstractComponent with component type in ScrollView (f…
Browse files Browse the repository at this point in the history
…acebook#46927)

Summary:

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

Changelog: [Internal]

Differential Revision: D64112934
  • Loading branch information
fabriziocucci authored and facebook-github-bot committed Oct 9, 2024
1 parent b1a0f54 commit 6d36d0c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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);
Original file line number Diff line number Diff line change
Expand Up @@ -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;
"
`;

Expand Down

0 comments on commit 6d36d0c

Please sign in to comment.