From 2fac662f6e5fb8f0d5066da0297cbb1754cf2393 Mon Sep 17 00:00:00 2001 From: grabbou Date: Mon, 28 Oct 2019 22:37:04 +0100 Subject: [PATCH] Revert "Fix ref type for Native Scroll View" This reverts commit db662af5b28d0ad42abd1da67c32f2c38ff04900. --- Libraries/Components/ScrollView/ScrollView.js | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/Libraries/Components/ScrollView/ScrollView.js b/Libraries/Components/ScrollView/ScrollView.js index 3c209e86513..0476fd9cde0 100644 --- a/Libraries/Components/ScrollView/ScrollView.js +++ b/Libraries/Components/ScrollView/ScrollView.js @@ -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 { return ReactNative.findNodeHandle(this._innerViewRef); } - getInnerViewRef(): ?React.ElementRef> { + getInnerViewRef(): ?React.ElementRef< + Class>, + > { return this._innerViewRef; } - getNativeScrollRef(): ?React.ElementRef> { + getNativeScrollRef(): ?React.ElementRef< + Class>, + > { return this._scrollViewRef; } @@ -947,13 +950,21 @@ class ScrollView extends React.Component { this.props.onContentSizeChange(width, height); }; - _scrollViewRef: ?React.ElementRef> = null; - _setScrollViewRef = (ref: ?React.ElementRef>) => { + _scrollViewRef: ?React.ElementRef< + Class>, + > = null; + _setScrollViewRef = ( + ref: ?React.ElementRef>>, + ) => { this._scrollViewRef = ref; }; - _innerViewRef: ?React.ElementRef> = null; - _setInnerViewRef = (ref: ?React.ElementRef>) => { + _innerViewRef: ?React.ElementRef< + Class>, + > = null; + _setInnerViewRef = ( + ref: ?React.ElementRef>>, + ) => { this._innerViewRef = ref; }; @@ -1057,6 +1068,7 @@ class ScrollView extends React.Component { const contentContainer = ( { // 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 {Platform.isTV ? null : refreshControl} {contentContainer} @@ -1184,6 +1197,7 @@ class ScrollView extends React.Component { {contentContainer} , @@ -1191,6 +1205,7 @@ class ScrollView extends React.Component { } } return ( + // $FlowFixMe {contentContainer}