mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
[LOCAL] Make ScrollView compatible with React 18.3.1
This commit is contained in:
@@ -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<
|
||||
|
||||
Reference in New Issue
Block a user