@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\\)*\\$FlowExpectedError
unsafe.enable_getters_and_setters=true
[version]
^0.61.0
^0.63.0

View File

@ -687,6 +687,9 @@ class CellRenderer extends React.Component<CellProps> {
}
};
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);

View File

@ -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') {

View File

@ -168,6 +168,9 @@ declare function setImmediate(callback: any, ...args: Array<any>): 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);

View File

@ -462,6 +462,9 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, 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<ItemT> extends React.PureComponent<Props<ItemT>, 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);
}
};

View File

@ -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<number> = new Set();
_viewableIndices: Array<number> = [];
_viewableItems: Map<string, ViewToken> = new Map();

View File

@ -589,6 +589,9 @@ class VirtualizedList extends React.PureComponent<Props, State> {
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<Props, State> {
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<Props, State> {
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<Props, State> {
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<Props, State> {
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<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;
};

View File

@ -233,6 +233,9 @@ class VirtualizedSectionList<SectionT: SectionBase> 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,
};

View File

@ -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: [

View File

@ -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);
}

View File

@ -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();

View File

@ -89,10 +89,16 @@ class Circle extends React.Component<any, any> {
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();
}

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();
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];
});

View File

@ -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);
}}
/>

View File

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

View File

@ -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",