Add suppressions for Flow v0.53.0 before React changes

Reviewed By: avikchaudhuri

Differential Revision: D5648801

fbshipit-source-id: c4eb1bee198a177b69b6e9414111ce957b4d27ff
This commit is contained in:
Caleb Meredith
2017-08-17 05:07:37 -07:00
committed by Facebook Github Bot
parent bb98fddbec
commit 30d9c3d279
18 changed files with 136 additions and 3 deletions

View File

@@ -548,6 +548,9 @@ const ScrollView = createReactClass({
},
_getKeyForIndex: function(index, childArray) {
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.53 was deployed. To see the error delete this
* comment and run Flow. */
const child = childArray[index];
return child && child.key;
},
@@ -577,6 +580,9 @@ const ScrollView = createReactClass({
if (!this.props.stickyHeaderIndices) {
return;
}
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.53 was deployed. To see the error delete this
* comment and run Flow. */
const childArray = React.Children.toArray(this.props.children);
if (key !== this._getKeyForIndex(index, childArray)) {
// ignore stale layout update
@@ -586,7 +592,13 @@ const ScrollView = createReactClass({
const layoutY = event.nativeEvent.layout.y;
this._headerLayoutYs.set(key, layoutY);
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.53 was deployed. To see the error delete this
* comment and run Flow. */
const indexOfIndex = this.props.stickyHeaderIndices.indexOf(index);
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.53 was deployed. To see the error delete this
* comment and run Flow. */
const previousHeaderIndex = this.props.stickyHeaderIndices[indexOfIndex - 1];
if (previousHeaderIndex != null) {
const previousHeader = this._stickyHeaderRefs.get(
@@ -685,18 +697,33 @@ const ScrollView = createReactClass({
const {stickyHeaderIndices} = this.props;
const hasStickyHeaders = stickyHeaderIndices && stickyHeaderIndices.length > 0;
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.53 was deployed. To see the error delete this
* comment and run Flow. */
const childArray = hasStickyHeaders && React.Children.toArray(this.props.children);
const children = hasStickyHeaders ?
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.53 was deployed. To see the error delete this
* comment and run Flow. */
childArray.map((child, index) => {
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.53 was deployed. To see the error delete
* this comment and run Flow. */
const indexOfIndex = child ? stickyHeaderIndices.indexOf(index) : -1;
if (indexOfIndex > -1) {
const key = child.key;
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses
* an error found when Flow v0.53 was deployed. To see the error
* delete this comment and run Flow. */
const nextIndex = stickyHeaderIndices[indexOfIndex + 1];
return (
<ScrollViewStickyHeader
key={key}
ref={(ref) => this._setStickyHeaderRef(key, ref)}
nextHeaderLayoutY={
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment
* suppresses an error found when Flow v0.53 was deployed. To
* see the error delete this comment and run Flow. */
this._headerLayoutYs.get(this._getKeyForIndex(nextIndex, childArray))
}
onLayout={(event) => this._onStickyHeaderLayout(index, event, key)}
@@ -708,6 +735,9 @@ const ScrollView = createReactClass({
return child;
}
}) :
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.53 was deployed. To see the error delete this
* comment and run Flow. */
this.props.children;
const contentContainer =
<ScrollContentContainerViewClass
@@ -752,6 +782,9 @@ const ScrollView = createReactClass({
onResponderGrant: this.scrollResponderHandleResponderGrant,
onResponderReject: this.scrollResponderHandleResponderReject,
onResponderRelease: this.scrollResponderHandleResponderRelease,
/* $FlowFixMe(>=0.53.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.53 was deployed. To see the error delete this
* comment and run Flow. */
onResponderTerminate: this.scrollResponderHandleTerminate,
onResponderTerminationRequest: this.scrollResponderHandleTerminationRequest,
onScroll: this._handleScroll,