From d3288776c1d93aa032f63aef3174990cb72579f7 Mon Sep 17 00:00:00 2001 From: Eli White Date: Fri, 11 Oct 2019 11:43:51 -0700 Subject: [PATCH] Fix ref type for Native Scroll View Summary: These types were wrong, this is a HostComponent, not a ReactNative.NativeComponent Reviewed By: lunaleaps Differential Revision: D17862305 fbshipit-source-id: e1e7acc7a5892f124b07cdc39d73d6ce7d414063 --- Libraries/Components/ScrollView/ScrollView.js | 29 +++++-------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/Libraries/Components/ScrollView/ScrollView.js b/Libraries/Components/ScrollView/ScrollView.js index 0476fd9cde0634..3c209e86513386 100644 --- a/Libraries/Components/ScrollView/ScrollView.js +++ b/Libraries/Components/ScrollView/ScrollView.js @@ -37,6 +37,7 @@ 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'; @@ -769,15 +770,11 @@ class ScrollView extends React.Component { return ReactNative.findNodeHandle(this._innerViewRef); } - getInnerViewRef(): ?React.ElementRef< - Class>, - > { + getInnerViewRef(): ?React.ElementRef> { return this._innerViewRef; } - getNativeScrollRef(): ?React.ElementRef< - Class>, - > { + getNativeScrollRef(): ?React.ElementRef> { return this._scrollViewRef; } @@ -950,21 +947,13 @@ class ScrollView extends React.Component { this.props.onContentSizeChange(width, height); }; - _scrollViewRef: ?React.ElementRef< - Class>, - > = null; - _setScrollViewRef = ( - ref: ?React.ElementRef>>, - ) => { + _scrollViewRef: ?React.ElementRef> = null; + _setScrollViewRef = (ref: ?React.ElementRef>) => { this._scrollViewRef = ref; }; - _innerViewRef: ?React.ElementRef< - Class>, - > = null; - _setInnerViewRef = ( - ref: ?React.ElementRef>>, - ) => { + _innerViewRef: ?React.ElementRef> = null; + _setInnerViewRef = (ref: ?React.ElementRef>) => { this._innerViewRef = ref; }; @@ -1068,7 +1057,6 @@ 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} @@ -1197,7 +1184,6 @@ class ScrollView extends React.Component { {contentContainer} , @@ -1205,7 +1191,6 @@ class ScrollView extends React.Component { } } return ( - // $FlowFixMe {contentContainer}