@allow-large-files [Flow] Upgrade xplat/js to flow v0.63

Reviewed By: samwgoldman

Differential Revision: D6675320

fbshipit-source-id: 85575a6f30a50a3c40c6b46ba36f8cd33c091b1d
This commit is contained in:
glevi@fb.com 2018-01-08 12:45:38 -08:00 committed by Facebook Github Bot
parent e5c2a66897
commit 6b95c4fb14
16 changed files with 69 additions and 10 deletions

View File

@ -51,7 +51,5 @@ suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
unsafe.enable_getters_and_setters=true
[version] [version]
^0.61.0 ^0.63.0

View File

@ -687,6 +687,9 @@ class CellRenderer extends React.Component<CellProps> {
} }
}; };
componentWillUnmount() { 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); clearTimeout(this._timeout);
this.props.onProgressChange({rowKey: this.props.rowKey, inProgress: false}); this.props.onProgressChange({rowKey: this.props.rowKey, inProgress: false});
this.props.onWillUnmount(this.props.rowKey); this.props.onWillUnmount(this.props.rowKey);

View File

@ -101,6 +101,9 @@ class Inspector extends React.Component<{
attachToDevtools = (agent: Object) => { attachToDevtools = (agent: Object) => {
let _hideWait = null; let _hideWait = null;
const hlSub = agent.sub('highlight', ({node, name, props}) => { 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); clearTimeout(_hideWait);
if (typeof node !== 'number') { if (typeof node !== 'number') {

View File

@ -168,6 +168,9 @@ declare function setImmediate(callback: any, ...args: Array<any>): number;
function _scheduleUpdate() { function _scheduleUpdate() {
if (!_nextUpdateHandle) { if (!_nextUpdateHandle) {
if (_deadline > 0) { 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); _nextUpdateHandle = setTimeout(_processUpdate, 0 + DEBUG_DELAY);
} else { } else {
_nextUpdateHandle = setImmediate(_processUpdate); _nextUpdateHandle = setImmediate(_processUpdate);

View File

@ -462,6 +462,9 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
}), }),
); );
} else if (this.props.onViewableItemsChanged) { } 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({ this._virtualizedListPairs.push({
viewabilityConfig: this.props.viewabilityConfig, viewabilityConfig: this.props.viewabilityConfig,
onViewableItemsChanged: this._createOnViewableItemsChanged( onViewableItemsChanged: this._createOnViewableItemsChanged(
@ -555,6 +558,9 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
.map((it, kk) => keyExtractor(it, index * numColumns + kk)) .map((it, kk) => keyExtractor(it, index * numColumns + kk))
.join(':'); .join(':');
} else { } 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); return keyExtractor(items, index);
} }
}; };

View File

@ -74,6 +74,9 @@ export type ViewabilityConfig = {|
class ViewabilityHelper { class ViewabilityHelper {
_config: ViewabilityConfig; _config: ViewabilityConfig;
_hasInteracted: boolean = false; _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<number> = new Set(); _timers: Set<number> = new Set();
_viewableIndices: Array<number> = []; _viewableIndices: Array<number> = [];
_viewableItems: Map<string, ViewToken> = new Map(); _viewableItems: Map<string, ViewToken> = new Map();

View File

@ -589,6 +589,9 @@ class VirtualizedList extends React.PureComponent<Props, State> {
if (this.props.initialScrollIndex) { if (this.props.initialScrollIndex) {
this._initialScrollIndexTimeout = setTimeout( 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({ this.scrollToIndex({
animated: false, animated: false,
index: this.props.initialScrollIndex, index: this.props.initialScrollIndex,
@ -615,6 +618,9 @@ class VirtualizedList extends React.PureComponent<Props, State> {
tuple.viewabilityHelper.dispose(); tuple.viewabilityHelper.dispose();
}); });
this._fillRateHelper.deactivateAndFlush(); 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); clearTimeout(this._initialScrollIndexTimeout);
} }
@ -1176,6 +1182,9 @@ class VirtualizedList extends React.PureComponent<Props, State> {
if ( if (
onEndReached && onEndReached &&
this.state.last === getItemCount(data) - 1 && 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 && distanceFromEnd < onEndReachedThreshold * visibleLength &&
(this._hasDataChangedSinceEndReached || (this._hasDataChangedSinceEndReached ||
this._scrollMetrics.contentLength !== this._sentEndForContentLength) this._scrollMetrics.contentLength !== this._sentEndForContentLength)
@ -1298,6 +1307,9 @@ class VirtualizedList extends React.PureComponent<Props, State> {
const distBottom = const distBottom =
this._getFrameMetricsApprox(last).offset - (offset + visibleLength); this._getFrameMetricsApprox(last).offset - (offset + visibleLength);
const scrollingThreshold = 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; this.props.onEndReachedThreshold * visibleLength / 2;
hiPri = hiPri =
Math.min(distTop, distBottom) < 0 || Math.min(distTop, distBottom) < 0 ||
@ -1374,6 +1386,9 @@ class VirtualizedList extends React.PureComponent<Props, State> {
const {contentLength, offset, visibleLength} = this._scrollMetrics; const {contentLength, offset, visibleLength} = this._scrollMetrics;
const distanceFromEnd = contentLength - visibleLength - offset; const distanceFromEnd = contentLength - visibleLength - offset;
const renderAhead = 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 distanceFromEnd < onEndReachedThreshold * visibleLength
? this.props.maxToRenderPerBatch ? this.props.maxToRenderPerBatch
: 0; : 0;
@ -1481,6 +1496,9 @@ class VirtualizedList extends React.PureComponent<Props, State> {
} }
} }
} }
/* $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; return frame;
}; };

View File

@ -233,6 +233,9 @@ class VirtualizedSectionList<SectionT: SectionBase> extends React.PureComponent<
return { return {
...viewable, ...viewable,
index: info.index, 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), key: keyExtractor(viewable.item, info.index),
section: info.section, section: info.section,
}; };

View File

@ -89,6 +89,9 @@ module.exports = {
testBadSectionsShape(): React.Element<*> { testBadSectionsShape(): React.Element<*> {
const sections = [ 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', key: 'a',
items: [ items: [

View File

@ -33,6 +33,9 @@ function flattenStyle(style: ?StyleObj): ?Object {
invariant(style !== true, 'style may be false but not true'); invariant(style !== true, 'style may be false but not true');
if (!Array.isArray(style)) { 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); return getStyle(style);
} }

View File

@ -35,10 +35,16 @@ class ToggleAnimatingActivityIndicator extends Component<$FlowFixMeProps, State>
} }
componentWillUnmount() { 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); clearTimeout(this._timer);
} }
setToggleTimeout() { 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._timer = setTimeout(() => {
this.setState({animating: !this.state.animating}); this.setState({animating: !this.state.animating});
this.setToggleTimeout(); this.setToggleTimeout();

View File

@ -89,10 +89,16 @@ class Circle extends React.Component<any, any> {
onResponderGrant: () => { onResponderGrant: () => {
this.state.pan.setValue({x: 0, y: 0}); // reset (step1: uncomment) this.state.pan.setValue({x: 0, y: 0}); // reset (step1: uncomment)
this.state.pan.setOffset(this.props.restLayout); // offset from onLayout (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); this.longTimer = setTimeout(this._onLongPress, 300);
}, },
onResponderRelease: () => { onResponderRelease: () => {
if (!this.state.panResponder) { 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); clearTimeout(this.longTimer);
this._toggleIsActive(); this._toggleIsActive();
} }

View File

@ -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(); const IMAGE_PREFETCH_URL = 'http://origami.design/public/images/bird-logo.png?r=1&t=' + Date.now();
var prefetchTask = Image.prefetch(IMAGE_PREFETCH_URL); 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({ var NetworkImageCallbackExample = createReactClass({
displayName: 'NetworkImageCallbackExample', displayName: 'NetworkImageCallbackExample',
getInitialState: function() { getInitialState: function() {
@ -98,9 +101,6 @@ var NetworkImageCallbackExample = createReactClass({
}, },
_loadEventFired(event) { _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) => { this.setState((state) => {
return state.events = [...state.events, event]; return state.events = [...state.events, event];
}); });

View File

@ -167,6 +167,9 @@ class InternalSettings extends React.Component<{}, {busyTime: number | string, f
initialValue={false} initialValue={false}
label="Force JS Stalls" label="Force JS Stalls"
onEnable={() => { 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(() => { this._stallInterval = setInterval(() => {
const start = Date.now(); const start = Date.now();
console.warn('burn CPU'); console.warn('burn CPU');
@ -175,6 +178,9 @@ class InternalSettings extends React.Component<{}, {busyTime: number | string, f
}, 300); }, 300);
}} }}
onDisable={() => { 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); clearInterval(this._stallInterval || 0);
}} }}
/> />

View File

@ -50,7 +50,5 @@ suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
unsafe.enable_getters_and_setters=true
[version] [version]
^0.61.0 ^0.63.0

View File

@ -208,7 +208,7 @@
"eslint-plugin-flowtype": "^2.33.0", "eslint-plugin-flowtype": "^2.33.0",
"eslint-plugin-prettier": "2.1.1", "eslint-plugin-prettier": "2.1.1",
"eslint-plugin-react": "^7.2.1", "eslint-plugin-react": "^7.2.1",
"flow-bin": "^0.61.0", "flow-bin": "^0.63.0",
"jest": "22.0.0", "jest": "22.0.0",
"prettier": "1.9.1", "prettier": "1.9.1",
"react": "16.2.0", "react": "16.2.0",