From 6b95c4fb142a7015b2afca50cc19eec0b8913d8c Mon Sep 17 00:00:00 2001 From: "glevi@fb.com" Date: Mon, 8 Jan 2018 12:45:38 -0800 Subject: [PATCH] @allow-large-files [Flow] Upgrade xplat/js to flow v0.63 Reviewed By: samwgoldman Differential Revision: D6675320 fbshipit-source-id: 85575a6f30a50a3c40c6b46ba36f8cd33c091b1d --- .flowconfig | 4 +--- Libraries/Experimental/WindowedListView.js | 3 +++ Libraries/Inspector/Inspector.js | 3 +++ Libraries/Interaction/InteractionManager.js | 3 +++ Libraries/Lists/FlatList.js | 6 ++++++ Libraries/Lists/ViewabilityHelper.js | 3 +++ Libraries/Lists/VirtualizedList.js | 18 ++++++++++++++++++ Libraries/Lists/VirtualizedSectionList.js | 3 +++ .../__flowtests__/SectionList-flowtest.js | 3 +++ Libraries/StyleSheet/flattenStyle.js | 3 +++ RNTester/js/ActivityIndicatorExample.js | 6 ++++++ RNTester/js/AnimatedGratuitousApp/AnExApp.js | 6 ++++++ RNTester/js/ImageExample.js | 6 +++--- RNTester/js/NativeAnimationsExample.js | 6 ++++++ local-cli/templates/HelloWorld/_flowconfig | 4 +--- package.json | 2 +- 16 files changed, 69 insertions(+), 10 deletions(-) diff --git a/.flowconfig b/.flowconfig index f63fddf53a8f7a..d2a66865c6fc6b 100644 --- a/.flowconfig +++ b/.flowconfig @@ -51,7 +51,5 @@ suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]* suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError -unsafe.enable_getters_and_setters=true - [version] -^0.61.0 +^0.63.0 diff --git a/Libraries/Experimental/WindowedListView.js b/Libraries/Experimental/WindowedListView.js index afbff25a42ba75..9d0e0ac9aa6f09 100644 --- a/Libraries/Experimental/WindowedListView.js +++ b/Libraries/Experimental/WindowedListView.js @@ -687,6 +687,9 @@ class CellRenderer extends React.Component { } }; componentWillUnmount() { + /* $FlowFixMe(>=0.63.0 site=react_native_fb) This comment suppresses an + * error found when Flow v0.63 was deployed. To see the error delete this + * comment and run Flow. */ clearTimeout(this._timeout); this.props.onProgressChange({rowKey: this.props.rowKey, inProgress: false}); this.props.onWillUnmount(this.props.rowKey); diff --git a/Libraries/Inspector/Inspector.js b/Libraries/Inspector/Inspector.js index 24439c504d8900..6cfe8c20e90f24 100644 --- a/Libraries/Inspector/Inspector.js +++ b/Libraries/Inspector/Inspector.js @@ -101,6 +101,9 @@ class Inspector extends React.Component<{ attachToDevtools = (agent: Object) => { let _hideWait = null; const hlSub = agent.sub('highlight', ({node, name, props}) => { + /* $FlowFixMe(>=0.63.0 site=react_native_fb) This comment suppresses an + * error found when Flow v0.63 was deployed. To see the error delete this + * comment and run Flow. */ clearTimeout(_hideWait); if (typeof node !== 'number') { diff --git a/Libraries/Interaction/InteractionManager.js b/Libraries/Interaction/InteractionManager.js index cd3863ec727dd7..489c5de9148f5f 100644 --- a/Libraries/Interaction/InteractionManager.js +++ b/Libraries/Interaction/InteractionManager.js @@ -168,6 +168,9 @@ declare function setImmediate(callback: any, ...args: Array): number; function _scheduleUpdate() { if (!_nextUpdateHandle) { if (_deadline > 0) { + /* $FlowFixMe(>=0.63.0 site=react_native_fb) This comment suppresses an + * error found when Flow v0.63 was deployed. To see the error delete this + * comment and run Flow. */ _nextUpdateHandle = setTimeout(_processUpdate, 0 + DEBUG_DELAY); } else { _nextUpdateHandle = setImmediate(_processUpdate); diff --git a/Libraries/Lists/FlatList.js b/Libraries/Lists/FlatList.js index 0f21d8520bf510..7ac2bb07073d81 100644 --- a/Libraries/Lists/FlatList.js +++ b/Libraries/Lists/FlatList.js @@ -462,6 +462,9 @@ class FlatList extends React.PureComponent, void> { }), ); } else if (this.props.onViewableItemsChanged) { + /* $FlowFixMe(>=0.63.0 site=react_native_fb) This comment suppresses an + * error found when Flow v0.63 was deployed. To see the error delete this + * comment and run Flow. */ this._virtualizedListPairs.push({ viewabilityConfig: this.props.viewabilityConfig, onViewableItemsChanged: this._createOnViewableItemsChanged( @@ -555,6 +558,9 @@ class FlatList extends React.PureComponent, void> { .map((it, kk) => keyExtractor(it, index * numColumns + kk)) .join(':'); } else { + /* $FlowFixMe(>=0.63.0 site=react_native_fb) This comment suppresses an + * error found when Flow v0.63 was deployed. To see the error delete this + * comment and run Flow. */ return keyExtractor(items, index); } }; diff --git a/Libraries/Lists/ViewabilityHelper.js b/Libraries/Lists/ViewabilityHelper.js index 03c84abdb92b7a..04bbef2f06e5fe 100644 --- a/Libraries/Lists/ViewabilityHelper.js +++ b/Libraries/Lists/ViewabilityHelper.js @@ -74,6 +74,9 @@ export type ViewabilityConfig = {| class ViewabilityHelper { _config: ViewabilityConfig; _hasInteracted: boolean = false; + /* $FlowFixMe(>=0.63.0 site=react_native_fb) This comment suppresses an error + * found when Flow v0.63 was deployed. To see the error delete this comment + * and run Flow. */ _timers: Set = new Set(); _viewableIndices: Array = []; _viewableItems: Map = new Map(); diff --git a/Libraries/Lists/VirtualizedList.js b/Libraries/Lists/VirtualizedList.js index 83b31ee7a56a47..63207f8865b412 100644 --- a/Libraries/Lists/VirtualizedList.js +++ b/Libraries/Lists/VirtualizedList.js @@ -589,6 +589,9 @@ class VirtualizedList extends React.PureComponent { if (this.props.initialScrollIndex) { this._initialScrollIndexTimeout = setTimeout( () => + /* $FlowFixMe(>=0.63.0 site=react_native_fb) This comment suppresses + * an error found when Flow v0.63 was deployed. To see the error + * delete this comment and run Flow. */ this.scrollToIndex({ animated: false, index: this.props.initialScrollIndex, @@ -615,6 +618,9 @@ class VirtualizedList extends React.PureComponent { tuple.viewabilityHelper.dispose(); }); this._fillRateHelper.deactivateAndFlush(); + /* $FlowFixMe(>=0.63.0 site=react_native_fb) This comment suppresses an + * error found when Flow v0.63 was deployed. To see the error delete this + * comment and run Flow. */ clearTimeout(this._initialScrollIndexTimeout); } @@ -1176,6 +1182,9 @@ class VirtualizedList extends React.PureComponent { if ( onEndReached && this.state.last === getItemCount(data) - 1 && + /* $FlowFixMe(>=0.63.0 site=react_native_fb) This comment suppresses an + * error found when Flow v0.63 was deployed. To see the error delete this + * comment and run Flow. */ distanceFromEnd < onEndReachedThreshold * visibleLength && (this._hasDataChangedSinceEndReached || this._scrollMetrics.contentLength !== this._sentEndForContentLength) @@ -1298,6 +1307,9 @@ class VirtualizedList extends React.PureComponent { const distBottom = this._getFrameMetricsApprox(last).offset - (offset + visibleLength); const scrollingThreshold = + /* $FlowFixMe(>=0.63.0 site=react_native_fb) This comment suppresses an + * error found when Flow v0.63 was deployed. To see the error delete + * this comment and run Flow. */ this.props.onEndReachedThreshold * visibleLength / 2; hiPri = Math.min(distTop, distBottom) < 0 || @@ -1374,6 +1386,9 @@ class VirtualizedList extends React.PureComponent { const {contentLength, offset, visibleLength} = this._scrollMetrics; const distanceFromEnd = contentLength - visibleLength - offset; const renderAhead = + /* $FlowFixMe(>=0.63.0 site=react_native_fb) This comment suppresses + * an error found when Flow v0.63 was deployed. To see the error + * delete this comment and run Flow. */ distanceFromEnd < onEndReachedThreshold * visibleLength ? this.props.maxToRenderPerBatch : 0; @@ -1481,6 +1496,9 @@ class VirtualizedList extends React.PureComponent { } } } + /* $FlowFixMe(>=0.63.0 site=react_native_fb) This comment suppresses an + * error found when Flow v0.63 was deployed. To see the error delete this + * comment and run Flow. */ return frame; }; diff --git a/Libraries/Lists/VirtualizedSectionList.js b/Libraries/Lists/VirtualizedSectionList.js index ca3a8708239a14..7ac700107c7725 100644 --- a/Libraries/Lists/VirtualizedSectionList.js +++ b/Libraries/Lists/VirtualizedSectionList.js @@ -233,6 +233,9 @@ class VirtualizedSectionList extends React.PureComponent< return { ...viewable, index: info.index, + /* $FlowFixMe(>=0.63.0 site=react_native_fb) This comment suppresses an + * error found when Flow v0.63 was deployed. To see the error delete this + * comment and run Flow. */ key: keyExtractor(viewable.item, info.index), section: info.section, }; diff --git a/Libraries/Lists/__flowtests__/SectionList-flowtest.js b/Libraries/Lists/__flowtests__/SectionList-flowtest.js index b452f736aa1853..035e9e6f0f010c 100644 --- a/Libraries/Lists/__flowtests__/SectionList-flowtest.js +++ b/Libraries/Lists/__flowtests__/SectionList-flowtest.js @@ -89,6 +89,9 @@ module.exports = { testBadSectionsShape(): React.Element<*> { const sections = [ + /* $FlowFixMe(>=0.63.0 site=react_native_fb) This comment suppresses an + * error found when Flow v0.63 was deployed. To see the error delete this + * comment and run Flow. */ { key: 'a', items: [ diff --git a/Libraries/StyleSheet/flattenStyle.js b/Libraries/StyleSheet/flattenStyle.js index 007349f4dca6b1..f0998626979d77 100644 --- a/Libraries/StyleSheet/flattenStyle.js +++ b/Libraries/StyleSheet/flattenStyle.js @@ -33,6 +33,9 @@ function flattenStyle(style: ?StyleObj): ?Object { invariant(style !== true, 'style may be false but not true'); if (!Array.isArray(style)) { + /* $FlowFixMe(>=0.63.0 site=react_native_fb) This comment suppresses an + * error found when Flow v0.63 was deployed. To see the error delete this + * comment and run Flow. */ return getStyle(style); } diff --git a/RNTester/js/ActivityIndicatorExample.js b/RNTester/js/ActivityIndicatorExample.js index e185041b7a9aa8..5daaf362155eb2 100644 --- a/RNTester/js/ActivityIndicatorExample.js +++ b/RNTester/js/ActivityIndicatorExample.js @@ -35,10 +35,16 @@ class ToggleAnimatingActivityIndicator extends Component<$FlowFixMeProps, State> } componentWillUnmount() { + /* $FlowFixMe(>=0.63.0 site=react_native_fb) This comment suppresses an + * error found when Flow v0.63 was deployed. To see the error delete this + * comment and run Flow. */ clearTimeout(this._timer); } setToggleTimeout() { + /* $FlowFixMe(>=0.63.0 site=react_native_fb) This comment suppresses an + * error found when Flow v0.63 was deployed. To see the error delete this + * comment and run Flow. */ this._timer = setTimeout(() => { this.setState({animating: !this.state.animating}); this.setToggleTimeout(); diff --git a/RNTester/js/AnimatedGratuitousApp/AnExApp.js b/RNTester/js/AnimatedGratuitousApp/AnExApp.js index 4351363dd44bec..268a409faeb068 100644 --- a/RNTester/js/AnimatedGratuitousApp/AnExApp.js +++ b/RNTester/js/AnimatedGratuitousApp/AnExApp.js @@ -89,10 +89,16 @@ class Circle extends React.Component { onResponderGrant: () => { this.state.pan.setValue({x: 0, y: 0}); // reset (step1: uncomment) this.state.pan.setOffset(this.props.restLayout); // offset from onLayout (step1: uncomment) + /* $FlowFixMe(>=0.63.0 site=react_native_fb) This comment suppresses + * an error found when Flow v0.63 was deployed. To see the error + * delete this comment and run Flow. */ this.longTimer = setTimeout(this._onLongPress, 300); }, onResponderRelease: () => { if (!this.state.panResponder) { + /* $FlowFixMe(>=0.63.0 site=react_native_fb) This comment + * suppresses an error found when Flow v0.63 was deployed. To see + * the error delete this comment and run Flow. */ clearTimeout(this.longTimer); this._toggleIsActive(); } diff --git a/RNTester/js/ImageExample.js b/RNTester/js/ImageExample.js index bda7ddaa361e92..6e677890404f24 100644 --- a/RNTester/js/ImageExample.js +++ b/RNTester/js/ImageExample.js @@ -30,6 +30,9 @@ var ImageCapInsetsExample = require('./ImageCapInsetsExample'); const IMAGE_PREFETCH_URL = 'http://origami.design/public/images/bird-logo.png?r=1&t=' + Date.now(); var prefetchTask = Image.prefetch(IMAGE_PREFETCH_URL); +/* $FlowFixMe(>=0.63.0 site=react_native_fb) This comment suppresses an error + * found when Flow v0.63 was deployed. To see the error delete this comment and + * run Flow. */ var NetworkImageCallbackExample = createReactClass({ displayName: 'NetworkImageCallbackExample', getInitialState: function() { @@ -98,9 +101,6 @@ var NetworkImageCallbackExample = createReactClass({ }, _loadEventFired(event) { - /* $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. */ this.setState((state) => { return state.events = [...state.events, event]; }); diff --git a/RNTester/js/NativeAnimationsExample.js b/RNTester/js/NativeAnimationsExample.js index e6baeb4ef8127a..ed6f1acaf7045a 100644 --- a/RNTester/js/NativeAnimationsExample.js +++ b/RNTester/js/NativeAnimationsExample.js @@ -167,6 +167,9 @@ class InternalSettings extends React.Component<{}, {busyTime: number | string, f initialValue={false} label="Force JS Stalls" onEnable={() => { + /* $FlowFixMe(>=0.63.0 site=react_native_fb) This comment + * suppresses an error found when Flow v0.63 was deployed. To see + * the error delete this comment and run Flow. */ this._stallInterval = setInterval(() => { const start = Date.now(); console.warn('burn CPU'); @@ -175,6 +178,9 @@ class InternalSettings extends React.Component<{}, {busyTime: number | string, f }, 300); }} onDisable={() => { + /* $FlowFixMe(>=0.63.0 site=react_native_fb) This comment + * suppresses an error found when Flow v0.63 was deployed. To see + * the error delete this comment and run Flow. */ clearInterval(this._stallInterval || 0); }} /> diff --git a/local-cli/templates/HelloWorld/_flowconfig b/local-cli/templates/HelloWorld/_flowconfig index 7d608958e5ffa8..0b611f07f457ee 100644 --- a/local-cli/templates/HelloWorld/_flowconfig +++ b/local-cli/templates/HelloWorld/_flowconfig @@ -50,7 +50,5 @@ suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]* suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError -unsafe.enable_getters_and_setters=true - [version] -^0.61.0 +^0.63.0 diff --git a/package.json b/package.json index 0415ee1395b895..16d100054387ed 100644 --- a/package.json +++ b/package.json @@ -208,7 +208,7 @@ "eslint-plugin-flowtype": "^2.33.0", "eslint-plugin-prettier": "2.1.1", "eslint-plugin-react": "^7.2.1", - "flow-bin": "^0.61.0", + "flow-bin": "^0.63.0", "jest": "22.0.0", "prettier": "1.9.1", "react": "16.2.0",