[LOCAL] Make ScrollView compatible with React 18.3.1

This commit is contained in:
Riccardo Cipolleschi
2024-09-09 16:57:24 +01:00
parent 13ab63b60a
commit 8041e410e3
@@ -1931,19 +1931,18 @@ function createRefForwarder<TNativeInstance, TPublicInstance>(
return state;
}
// TODO: After migrating to React 19, remove `forwardRef` from this component.
// 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.
function Wrapper({
ref,
...props
}: {
...Props,
const Wrapper = React.forwardRef(function Wrapper(
props: Props,
ref: React.RefSetter<PublicScrollViewInstance>,
}): React.Node {
): React.Node {
return <ScrollView {...props} scrollViewRef={ref} />;
}
});
Wrapper.displayName = 'ScrollView';
// $FlowExpectedError[prop-missing]
Wrapper.Context = ScrollViewContext;
module.exports = ((Wrapper: $FlowFixMe): React.AbstractComponent<