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

@ -2501,6 +2501,9 @@ class AnimatedEvent {
recMapping.setValue(recEvt);
} else if (typeof recMapping === 'object') {
for (const mappingKey in recMapping) {
/* $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. */
traverse(recMapping[mappingKey], recEvt[mappingKey], mappingKey);
}
}

View File

@ -37,6 +37,9 @@ type DefaultProps = {
/**
* Displays a circular loading indicator.
*/
/* $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 ActivityIndicator = createReactClass({
displayName: 'ActivityIndicator',
mixins: [NativeMethodsMixin],

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,

View File

@ -93,6 +93,9 @@ var Switch = createReactClass({
this._rctSwitch.setNativeProps({value: this.props.value});
}
//Change the props after the native props are set in case the props change removes the component
/* $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.onChange && this.props.onChange(event);
this.props.onValueChange && this.props.onValueChange(event.nativeEvent.value);
},

View File

@ -734,6 +734,9 @@ const TextInput = createReactClass({
}
props.autoCapitalize =
UIManager.AndroidTextInput.Constants.AutoCapitalizationType[this.props.autoCapitalize];
/* $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. */
var children = this.props.children;
var childCount = 0;
React.Children.forEach(children, () => ++childCount);
@ -894,6 +897,9 @@ const TextInput = createReactClass({
},
_onTextInput: function(event: Event) {
/* $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.onTextInput && this.props.onTextInput(event);
},

View File

@ -136,6 +136,9 @@ var TouchableHighlight = createReactClass({
},
getInitialState: function() {
/* $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._isMounted = false;
return merge(
this.touchableGetInitialState(), this._computeSyntheticState(this.props)
@ -143,12 +146,18 @@ var TouchableHighlight = createReactClass({
},
componentDidMount: function() {
/* $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._isMounted = true;
ensurePositiveDelayProps(this.props);
ensureComponentIsNative(this.refs[CHILD_REF]);
},
componentWillUnmount: function() {
/* $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._isMounted = false;
},
@ -176,6 +185,9 @@ var TouchableHighlight = createReactClass({
*/
touchableHandleActivePressIn: function(e: Event) {
this.clearTimeout(this._hideTimeout);
/* $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._hideTimeout = null;
this._showUnderlay();
this.props.onPressIn && this.props.onPressIn(e);
@ -191,6 +203,9 @@ var TouchableHighlight = createReactClass({
touchableHandlePress: function(e: Event) {
this.clearTimeout(this._hideTimeout);
this._showUnderlay();
/* $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._hideTimeout = this.setTimeout(this._hideUnderlay,
this.props.delayPressOut || 100);
this.props.onPress && this.props.onPress(e);
@ -232,6 +247,9 @@ var TouchableHighlight = createReactClass({
_hideUnderlay: function() {
this.clearTimeout(this._hideTimeout);
/* $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._hideTimeout = null;
if (this._hasPressHandler() && this.refs[UNDERLAY_REF]) {
this.refs[CHILD_REF].setNativeProps(INACTIVE_CHILD_PROPS);
@ -256,6 +274,9 @@ var TouchableHighlight = createReactClass({
return (
<View
accessible={this.props.accessible !== false}
/* $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. */
accessibilityLabel={this.props.accessibilityLabel}
accessibilityComponentType={this.props.accessibilityComponentType}
accessibilityTraits={this.props.accessibilityTraits}
@ -272,9 +293,18 @@ var TouchableHighlight = createReactClass({
onResponderMove={this.touchableHandleResponderMove}
onResponderRelease={this.touchableHandleResponderRelease}
onResponderTerminate={this.touchableHandleResponderTerminate}
/* $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. */
nativeID={this.props.nativeID}
/* $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. */
testID={this.props.testID}>
{React.cloneElement(
/* $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. */
React.Children.only(this.props.children),
{
ref: CHILD_REF,

View File

@ -115,6 +115,9 @@ class SwipeableListView extends React.Component<DefaultProps, Props, State> {
render(): React.Element<any> {
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. */
<ListView
{...this.props}
ref={(ref) => {

View File

@ -53,6 +53,9 @@ class BoxContainer extends React.Component {
return (
<View style={styles.box}>
<View style={styles.row}>
{/* $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. */}
<Text style={[this.props.titleStyle, styles.label]}>{this.props.title}</Text>
<Text style={styles.boxText}>{box.top}</Text>
</View>

View File

@ -92,6 +92,9 @@ var DEFAULT_SCROLL_CALLBACK_THROTTLE = 50;
* rendering rows.
*/
/* $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. */
var ListView = createReactClass({
displayName: 'ListView',
_childFrames: ([]: Array<Object>),
@ -516,6 +519,9 @@ var ListView = createReactClass({
}
Object.assign(props, {
onScroll: this._onScroll,
/* $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. */
stickyHeaderIndices: this.props.stickyHeaderIndices.concat(
stickySectionHeaderIndices,
),

View File

@ -18,7 +18,13 @@ var warning = require('fbjs/lib/warning');
function defaultGetRowData(
dataBlob: any,
/* $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. */
sectionID: number | string,
/* $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. */
rowID: number | string,
): any {
return dataBlob[sectionID][rowID];

View File

@ -24,6 +24,9 @@ type Item = any;
type NormalProps = {
FooterComponent?: ReactClass<*>,
renderItem: (info: Object) => ?React.Element<*>,
/* $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. */
renderSectionHeader?: ({section: Object}) => ?React.Element<*>,
SeparatorComponent?: ?ReactClass<*>, // not supported yet
@ -105,9 +108,15 @@ class MetroListView extends React.Component {
renderScrollComponent: (props: Props) => {
if (props.onRefresh) {
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. */
<ScrollView
{...props}
refreshControl={
/* $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. */
<RefreshControl
refreshing={props.refreshing}
onRefresh={props.onRefresh}
@ -116,6 +125,9 @@ class MetroListView extends React.Component {
/>
);
} else {
/* $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. */
return <ScrollView {...props} />;
}
},
@ -134,6 +146,9 @@ class MetroListView extends React.Component {
}
render() {
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. */
<ListView
{...this.props}
dataSource={this.state.ds}

View File

@ -753,9 +753,15 @@ class VirtualizedList extends React.PureComponent<OptionalProps, Props, State> {
'`',
);
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. */
<ScrollView
{...props}
refreshControl={
/* $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. */
<RefreshControl
refreshing={props.refreshing}
onRefresh={props.onRefresh}
@ -765,6 +771,9 @@ class VirtualizedList extends React.PureComponent<OptionalProps, Props, State> {
/>
);
} else {
/* $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. */
return <ScrollView {...props} />;
}
};

View File

@ -11,6 +11,9 @@
*/
'use strict';
/* $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. */
import type React from 'react';
export type MeasureOnSuccessCallback = (

View File

@ -11,6 +11,9 @@
*/
'use strict';
/* $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. */
import type React from 'react';
export type Example = {

View File

@ -98,6 +98,9 @@ var NetworkImageCallbackExample = createReactClass({
},
_loadEventFired(event) {
/* $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.setState((state) => {
return state.events = [...state.events, event];
});

View File

@ -52,6 +52,9 @@ class Button extends React.Component {
onHideUnderlay={this._onUnhighlight}
onPress={this.props.onPress}
onShowUnderlay={this._onHighlight}
/* $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. */
style={[styles.button, this.props.style]}
underlayColor="#a9d9d4">
<Text style={[styles.buttonText, colorStyle]}>{this.props.children}</Text>

View File

@ -310,6 +310,9 @@ class SelectionExample extends React.Component {
return (
<View>
<TextInput
/* $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. */
multiline={this.props.multiline}
onChangeText={(value) => this.setState({value})}
onSelectionChange={this.onSelectionChange.bind(this)}

View File

@ -48,9 +48,7 @@ function server(argv: mixed, config: RNConfig, allArgs: Object) {
type: 'initialize_packager_done',
});
};
/* $FlowFixMe: we would have either to invariant() everything, or to
* auto-generate CLI args Flow types. */
// $FlowFixMe: Remove me to see the error.
const runServerArgs: RunServerArgs = args;
/* $FlowFixMe: ConfigT shouldn't be extendable. */
const configT: ConfigT = config;