mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Revert "Fix ref type for Native Scroll View"
This reverts commit db662af5b2.
This commit is contained in:
@@ -37,7 +37,6 @@ import type {
|
||||
ScrollEvent,
|
||||
LayoutEvent,
|
||||
} from '../../Types/CoreEventTypes';
|
||||
import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
|
||||
import type {State as ScrollResponderState} from '../ScrollResponder';
|
||||
import type {ViewProps} from '../View/ViewPropTypes';
|
||||
import type {Props as ScrollViewStickyHeaderProps} from './ScrollViewStickyHeader';
|
||||
@@ -770,11 +769,15 @@ class ScrollView extends React.Component<Props, State> {
|
||||
return ReactNative.findNodeHandle(this._innerViewRef);
|
||||
}
|
||||
|
||||
getInnerViewRef(): ?React.ElementRef<HostComponent<mixed>> {
|
||||
getInnerViewRef(): ?React.ElementRef<
|
||||
Class<ReactNative.NativeComponent<mixed>>,
|
||||
> {
|
||||
return this._innerViewRef;
|
||||
}
|
||||
|
||||
getNativeScrollRef(): ?React.ElementRef<HostComponent<mixed>> {
|
||||
getNativeScrollRef(): ?React.ElementRef<
|
||||
Class<ReactNative.NativeComponent<mixed>>,
|
||||
> {
|
||||
return this._scrollViewRef;
|
||||
}
|
||||
|
||||
@@ -947,13 +950,21 @@ class ScrollView extends React.Component<Props, State> {
|
||||
this.props.onContentSizeChange(width, height);
|
||||
};
|
||||
|
||||
_scrollViewRef: ?React.ElementRef<HostComponent<mixed>> = null;
|
||||
_setScrollViewRef = (ref: ?React.ElementRef<HostComponent<mixed>>) => {
|
||||
_scrollViewRef: ?React.ElementRef<
|
||||
Class<ReactNative.NativeComponent<mixed>>,
|
||||
> = null;
|
||||
_setScrollViewRef = (
|
||||
ref: ?React.ElementRef<Class<ReactNative.NativeComponent<mixed>>>,
|
||||
) => {
|
||||
this._scrollViewRef = ref;
|
||||
};
|
||||
|
||||
_innerViewRef: ?React.ElementRef<HostComponent<mixed>> = null;
|
||||
_setInnerViewRef = (ref: ?React.ElementRef<HostComponent<mixed>>) => {
|
||||
_innerViewRef: ?React.ElementRef<
|
||||
Class<ReactNative.NativeComponent<mixed>>,
|
||||
> = null;
|
||||
_setInnerViewRef = (
|
||||
ref: ?React.ElementRef<Class<ReactNative.NativeComponent<mixed>>>,
|
||||
) => {
|
||||
this._innerViewRef = ref;
|
||||
};
|
||||
|
||||
@@ -1057,6 +1068,7 @@ class ScrollView extends React.Component<Props, State> {
|
||||
const contentContainer = (
|
||||
<ScrollContentContainerViewClass
|
||||
{...contentSizeChangeProps}
|
||||
// $FlowFixMe Invalid prop usage
|
||||
ref={this._setInnerViewRef}
|
||||
style={contentContainerStyle}
|
||||
removeClippedSubviews={
|
||||
@@ -1166,6 +1178,7 @@ class ScrollView extends React.Component<Props, State> {
|
||||
// On iOS the RefreshControl is a child of the ScrollView.
|
||||
// tvOS lacks native support for RefreshControl, so don't include it in that case
|
||||
return (
|
||||
// $FlowFixMe
|
||||
<ScrollViewClass {...props} ref={this._setScrollViewRef}>
|
||||
{Platform.isTV ? null : refreshControl}
|
||||
{contentContainer}
|
||||
@@ -1184,6 +1197,7 @@ class ScrollView extends React.Component<Props, State> {
|
||||
<ScrollViewClass
|
||||
{...props}
|
||||
style={[baseStyle, inner]}
|
||||
// $FlowFixMe
|
||||
ref={this._setScrollViewRef}>
|
||||
{contentContainer}
|
||||
</ScrollViewClass>,
|
||||
@@ -1191,6 +1205,7 @@ class ScrollView extends React.Component<Props, State> {
|
||||
}
|
||||
}
|
||||
return (
|
||||
// $FlowFixMe
|
||||
<ScrollViewClass {...props} ref={this._setScrollViewRef}>
|
||||
{contentContainer}
|
||||
</ScrollViewClass>
|
||||
|
||||
Reference in New Issue
Block a user