diff --git a/Libraries/Lists/VirtualizedList.js b/Libraries/Lists/VirtualizedList.js index 24367f8b83..e5963980f5 100644 --- a/Libraries/Lists/VirtualizedList.js +++ b/Libraries/Lists/VirtualizedList.js @@ -314,9 +314,11 @@ class VirtualizedList extends React.PureComponent { this._footerLength - this._scrollMetrics.visibleLength, ); - /* $FlowFixMe(>=0.53.0 site=react_native_fb,react_native_oss) This comment - * suppresses an error when upgrading Flow's support for React. To see the - * error delete this comment and run Flow. */ + + if (this._scrollRef == null) { + return; + } + this._scrollRef.scrollTo( this.props.horizontal ? {x: offset, animated} : {y: offset, animated}, ); @@ -364,9 +366,11 @@ class VirtualizedList extends React.PureComponent { (viewPosition || 0) * (this._scrollMetrics.visibleLength - frame.length), ) - (viewOffset || 0); - /* $FlowFixMe(>=0.53.0 site=react_native_fb,react_native_oss) This comment - * suppresses an error when upgrading Flow's support for React. To see the - * error delete this comment and run Flow. */ + + if (this._scrollRef == null) { + return; + } + this._scrollRef.scrollTo( horizontal ? {x: offset, animated} : {y: offset, animated}, ); @@ -402,9 +406,11 @@ class VirtualizedList extends React.PureComponent { */ scrollToOffset(params: {animated?: ?boolean, offset: number}) { const {animated, offset} = params; - /* $FlowFixMe(>=0.53.0 site=react_native_fb,react_native_oss) This comment - * suppresses an error when upgrading Flow's support for React. To see the - * error delete this comment and run Flow. */ + + if (this._scrollRef == null) { + return; + } + this._scrollRef.scrollTo( this.props.horizontal ? {x: offset, animated} : {y: offset, animated}, ); @@ -421,9 +427,10 @@ class VirtualizedList extends React.PureComponent { } flashScrollIndicators() { - /* $FlowFixMe(>=0.53.0 site=react_native_fb,react_native_oss) This comment - * suppresses an error when upgrading Flow's support for React. To see the - * error delete this comment and run Flow. */ + if (this._scrollRef == null) { + return; + } + this._scrollRef.flashScrollIndicators(); } @@ -1019,13 +1026,10 @@ class VirtualizedList extends React.PureComponent { ? this.props.invertStickyHeaders : this.props.inverted, stickyHeaderIndices, + style: inversionStyle + ? [inversionStyle, this.props.style] + : this.props.style, }; - if (inversionStyle) { - /* $FlowFixMe(>=0.70.0 site=react_native_fb) This comment suppresses an - * error found when Flow v0.70 was deployed. To see the error delete - * this comment and run Flow. */ - scrollProps.style = [inversionStyle, this.props.style]; - } this._hasMore = this.state.last < this.props.getItemCount(this.props.data) - 1;