Add flow suppressions to xplat android

Summary:
.android.js files may be checked (when the next version of flow is released) by using `flow start --flowconfig-name .flowconfig.android` and `flow status --flowconfig-name .flowconfig.android`

This diff adds suppressions to the errors that are in .android.js files, which flow does not check right now.

When site is `react_native_fb` or `react_native_android_fb`, error will be suppressed when checking with .flowconfig.android
When site is `react_native_fb` or `react_native_ios_fb`, error will be suppressed when checking with .flowconfig.

You can use `react_native_fb` when it should be suppressed for both.

The controller you requested could not be found.

Reviewed By: TheSavior

Differential Revision: D9122178

fbshipit-source-id: 0ec9d3cae3d887f58645e6585b2a3f6c3889b13e
This commit is contained in:
Jordan Brown 2018-08-13 11:14:35 -07:00 committed by Facebook Github Bot
parent 35bd17f1d6
commit f125815efc
13 changed files with 140 additions and 0 deletions

View File

@ -35,6 +35,8 @@ const _subscriptions = new Map();
*/
const AccessibilityInfo = {
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
fetch: function(): Promise {
return new Promise((resolve, reject) => {
RCTAccessibilityInfo.isTouchExplorationEnabled(function(resp) {

View File

@ -103,6 +103,8 @@ const ActivityIndicator = (
styles.container,
style,
)}>
{/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was
* found when making Flow check .android.js files. */}
<RCTActivityIndicator {...nativeProps} />
</View>
);

View File

@ -131,7 +131,11 @@ let CheckBox = createReactClass({
let props = {...this.props};
props.onStartShouldSetResponder = () => true;
props.onResponderTerminationRequest = () => false;
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
props.enabled = !this.props.disabled;
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
props.on = this.props.value;
props.style = [styles.rctCheckBox, this.props.style];

View File

@ -49,6 +49,8 @@ class PickerAndroid extends React.Component<
},
*,
> {
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
static propTypes = {
...ViewPropTypes,
style: pickerStyleType,
@ -60,6 +62,8 @@ class PickerAndroid extends React.Component<
testID: ReactPropTypes.string,
};
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
constructor(props, context) {
super(props, context);
const state = this._stateFromProps(props);
@ -70,6 +74,8 @@ class PickerAndroid extends React.Component<
};
}
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
UNSAFE_componentWillReceiveProps(nextProps) {
this.setState(this._stateFromProps(nextProps));
}
@ -86,6 +92,8 @@ class PickerAndroid extends React.Component<
label: child.props.label,
};
if (child.props.color) {
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was
* found when making Flow check .android.js files. */
childProps.color = processColor(child.props.color);
}
return childProps;
@ -106,6 +114,8 @@ class PickerAndroid extends React.Component<
selected: this.state.initialSelectedIndex,
testID: this.props.testID,
style: [styles.pickerAndroid, this.props.style],
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
accessibilityLabel: this.props.accessibilityLabel,
};
@ -116,18 +126,26 @@ class PickerAndroid extends React.Component<
if (this.props.onValueChange) {
const position = event.nativeEvent.position;
if (position >= 0) {
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was
* found when making Flow check .android.js files. */
const children = React.Children.toArray(this.props.children);
const value = children[position].props.value;
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was
* found when making Flow check .android.js files. */
this.props.onValueChange(value, position);
} else {
this.props.onValueChange(null, position);
}
}
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
this._lastNativePosition = event.nativeEvent.position;
this.forceUpdate();
};
componentDidMount() {
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
this._lastNativePosition = this.state.initialSelectedIndex;
}
@ -140,11 +158,15 @@ class PickerAndroid extends React.Component<
// truth, not the native component.
if (
this.refs[REF_PICKER] &&
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
this.state.selectedIndex !== this._lastNativePosition
) {
this.refs[REF_PICKER].setNativeProps({
selected: this.state.selectedIndex,
});
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
this._lastNativePosition = this.state.selectedIndex;
}
}

View File

@ -12,4 +12,6 @@
const NativeEventEmitter = require('NativeEventEmitter');
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found when
* making Flow check .android.js files. */
module.exports = new NativeEventEmitter('StatusBarManager');

View File

@ -82,6 +82,8 @@ class ViewPagerAndroid extends React.Component<{
keyboardDismissMode?: 'none' | 'on-drag',
scrollEnabled?: boolean,
}> {
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
static propTypes = {
...ViewPropTypes,
/**
@ -154,14 +156,20 @@ class ViewPagerAndroid extends React.Component<{
}
}
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
getInnerViewNode = (): ReactComponent => {
return this.refs[VIEWPAGER_REF].getInnerViewNode();
};
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
_childrenWithOverridenStyle = (): Array => {
// Override styles so that each page will fill the parent. Native component
// will handle positioning of elements, so it's not important to offset
// them correctly.
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
return React.Children.map(this.props.children, function(child) {
if (!child) {
return null;
@ -247,6 +255,8 @@ class ViewPagerAndroid extends React.Component<{
<NativeAndroidViewPager
{...this.props}
ref={VIEWPAGER_REF}
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was
* found when making Flow check .android.js files. */
style={this.props.style}
onPageScroll={this._onPageScroll}
onPageScrollStateChanged={this._onPageScrollStateChanged}

View File

@ -219,8 +219,12 @@ let Image = (
let style;
let sources;
if (source?.uri != null) {
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
const {width, height} = source;
style = flattenStyle([{width, height}, styles.base, props.style]);
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
sources = [{uri: source.uri}];
} else {
style = flattenStyle([styles.base, props.style]);
@ -232,6 +236,8 @@ let Image = (
style,
shouldNotifyLoadEvents: !!(onLoadStart || onLoad || onLoadEnd || onError),
src: sources,
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
headers: source?.headers,
defaultSrc: defaultSource ? defaultSource.uri : null,
loadingIndicatorSrc: loadingIndicatorSource

View File

@ -522,6 +522,8 @@ class XMLHttpRequest extends EventTarget(...XHR_EVENTS) {
this._url,
this._headers,
data,
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
nativeResponseType,
incrementalEvents,
this.timeout,

View File

@ -48,6 +48,8 @@ class ProgressBarAndroidExample extends React.Component<{}> {
return (
<RNTesterPage title="ProgressBar Examples">
<RNTesterBlock title="Horizontal Indeterminate ProgressBar">
{/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was
* found when making Flow check .android.js files. */}
<ProgressBar styleAttr="Horizontal" />
</RNTesterBlock>
@ -56,6 +58,8 @@ class ProgressBarAndroidExample extends React.Component<{}> {
</RNTesterBlock>
<RNTesterBlock title="Horizontal Black Indeterminate ProgressBar">
{/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was
* found when making Flow check .android.js files. */}
<ProgressBar styleAttr="Horizontal" color="black" />
</RNTesterBlock>

View File

@ -23,6 +23,8 @@ const ToolbarAndroid = require('ToolbarAndroid');
const RNTesterActions = require('./RNTesterActions');
const RNTesterExampleContainer = require('./RNTesterExampleContainer');
const RNTesterExampleList = require('./RNTesterExampleList');
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found when
* making Flow check .android.js files. */
const RNTesterList = require('./RNTesterList');
const RNTesterNavigationReducer = require('./RNTesterNavigationReducer');
const UIManager = require('UIManager');
@ -96,12 +98,18 @@ class RNTesterApp extends React.Component<Props, RNTesterNavigationState> {
drawerWidth={Dimensions.get('window').width - DRAWER_WIDTH_LEFT}
keyboardDismissMode="on-drag"
onDrawerOpen={() => {
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was
* found when making Flow check .android.js files. */
this._overrideBackPressForDrawerLayout = true;
}}
onDrawerClose={() => {
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was
* found when making Flow check .android.js files. */
this._overrideBackPressForDrawerLayout = false;
}}
ref={drawer => {
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was
* found when making Flow check .android.js files. */
this.drawer = drawer;
}}
renderNavigationView={this._renderDrawerContent}
@ -114,6 +122,8 @@ class RNTesterApp extends React.Component<Props, RNTesterNavigationState> {
_renderDrawerContent = () => {
return (
<View style={styles.drawerContentWrapper}>
{/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was
* found when making Flow check .android.js files. */}
<RNTesterExampleList
list={RNTesterList}
displayTitleRow={true}
@ -136,6 +146,8 @@ class RNTesterApp extends React.Component<Props, RNTesterNavigationState> {
this._handleAction(RNTesterActions.Back());
}}
ref={example => {
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue
* was found when making Flow check .android.js files. */
this._exampleRef = example;
}}
/>
@ -146,6 +158,8 @@ class RNTesterApp extends React.Component<Props, RNTesterNavigationState> {
<ToolbarAndroid
logo={HEADER_LOGO_ICON}
navIcon={HEADER_NAV_ICON}
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue
* was found when making Flow check .android.js files. */
onIconClicked={() => this.drawer.openDrawer()}
style={styles.toolbar}
title={ExampleModule.title}
@ -153,6 +167,8 @@ class RNTesterApp extends React.Component<Props, RNTesterNavigationState> {
<RNTesterExampleContainer
module={ExampleModule}
ref={example => {
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue
* was found when making Flow check .android.js files. */
this._exampleRef = example;
}}
/>
@ -166,10 +182,14 @@ class RNTesterApp extends React.Component<Props, RNTesterNavigationState> {
<ToolbarAndroid
logo={HEADER_LOGO_ICON}
navIcon={HEADER_NAV_ICON}
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was
* found when making Flow check .android.js files. */
onIconClicked={() => this.drawer.openDrawer()}
style={styles.toolbar}
title="RNTester"
/>
{/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was
* found when making Flow check .android.js files. */}
<RNTesterExampleList
onNavigate={this._handleAction}
list={RNTesterList}
@ -179,6 +199,8 @@ class RNTesterApp extends React.Component<Props, RNTesterNavigationState> {
}
_handleAction = (action: Object): boolean => {
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
this.drawer && this.drawer.closeDrawer();
const newState = RNTesterNavigationReducer(this.state, action);
if (this.state !== newState) {
@ -191,16 +213,24 @@ class RNTesterApp extends React.Component<Props, RNTesterNavigationState> {
};
_handleBackButtonPress = () => {
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
if (this._overrideBackPressForDrawerLayout) {
// This hack is necessary because drawer layout provides an imperative API
// with open and close methods. This code would be cleaner if the drawer
// layout provided an `isOpen` prop and allowed us to pass a `onDrawerClose` handler.
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
this.drawer && this.drawer.closeDrawer();
return true;
}
if (
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
this._exampleRef &&
this._exampleRef.handleBackAction &&
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
this._exampleRef.handleBackAction()
) {
return true;

View File

@ -21,6 +21,8 @@ const RNTesterActions = require('./RNTesterActions');
const RNTesterStatePersister = require('./RNTesterStatePersister');
const View = require('View');
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found when
* making Flow check .android.js files. */
import type {RNTesterExample} from './RNTesterList.ios';
import type {PassProps} from './RNTesterStatePersister';
import type {DangerouslyImpreciseStyleProp} from 'StyleSheet';

View File

@ -62,6 +62,8 @@ const ComponentExamples: Array<RNTesterExample> = [
},
{
key: 'ProgressBarAndroidExample',
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
module: require('./ProgressBarAndroidExample'),
},
{
@ -98,14 +100,20 @@ const ComponentExamples: Array<RNTesterExample> = [
},
{
key: 'TextExample',
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
module: require('./TextExample'),
},
{
key: 'TextInputExample',
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
module: require('./TextInputExample'),
},
{
key: 'ToolbarAndroidExample',
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
module: require('./ToolbarAndroidExample'),
},
{
@ -118,6 +126,8 @@ const ComponentExamples: Array<RNTesterExample> = [
},
{
key: 'ViewPagerAndroidExample',
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
module: require('./ViewPagerAndroidExample'),
},
{
@ -129,6 +139,8 @@ const ComponentExamples: Array<RNTesterExample> = [
const APIExamples: Array<RNTesterExample> = [
{
key: 'AccessibilityAndroidExample',
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
module: require('./AccessibilityAndroidExample'),
},
{
@ -205,6 +217,8 @@ const APIExamples: Array<RNTesterExample> = [
},
{
key: 'PermissionsExampleAndroid',
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
module: require('./PermissionsExampleAndroid'),
},
{
@ -229,6 +243,8 @@ const APIExamples: Array<RNTesterExample> = [
},
{
key: 'ToastAndroidExample',
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
module: require('./ToastAndroidExample'),
},
{

View File

@ -84,6 +84,8 @@ class RewriteExample extends React.Component<$FlowFixMeProps, $FlowFixMeState> {
var remainder = limit - this.state.text.length;
var remainderColor = remainder > 5 ? 'blue' : 'red';
return (
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
<View style={styles.rewriteContainer}>
<TextInput
multiline={false}
@ -92,9 +94,13 @@ class RewriteExample extends React.Component<$FlowFixMeProps, $FlowFixMeState> {
text = text.replace(/ /g, '_');
this.setState({text});
}}
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was
* found when making Flow check .android.js files. */
style={styles.default}
value={this.state.text}
/>
{/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was
* found when making Flow check .android.js files. */}
<Text style={[styles.remainder, {color: remainderColor}]}>
{remainder}
</Text>
@ -299,6 +305,8 @@ class SelectionExample extends React.Component<
onChangeText={value => this.setState({value})}
onSelectionChange={this.onSelectionChange.bind(this)}
ref={textInput => (this._textInput = textInput)}
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was
* found when making Flow check .android.js files. */
selection={this.state.selection}
style={this.props.style}
value={this.state.value}
@ -324,6 +332,8 @@ class AutogrowingTextInputExample extends React.Component<{}> {
constructor(props) {
super(props);
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
this.state = {
width: 100,
multiline: true,
@ -336,12 +346,18 @@ class AutogrowingTextInputExample extends React.Component<{}> {
}
UNSAFE_componentWillReceiveProps(props) {
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
this.setState({
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
multiline: props.multiline,
});
}
render() {
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
var {style, multiline, ...props} = this.props;
return (
<View>
@ -351,25 +367,43 @@ class AutogrowingTextInputExample extends React.Component<{}> {
minimumValue={0}
maximumValue={100}
step={10}
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was
* found when making Flow check .android.js files. */
onValueChange={value => this.setState({width: value})}
/>
<Text>Multiline:</Text>
<Switch
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was
* found when making Flow check .android.js files. */
value={this.state.multiline}
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was
* found when making Flow check .android.js files. */
onValueChange={value => this.setState({multiline: value})}
/>
<Text>TextInput:</Text>
<TextInput
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was
* found when making Flow check .android.js files. */
multiline={this.state.multiline}
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was
* found when making Flow check .android.js files. */
style={[style, {width: this.state.width + '%'}]}
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was
* found when making Flow check .android.js files. */
onChangeText={value => this.setState({text: value})}
onContentSizeChange={event =>
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was
* found when making Flow check .android.js files. */
this.setState({contentSize: event.nativeEvent.contentSize})
}
{...props}
/>
<Text>Plain text value representation:</Text>
{/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was
* found when making Flow check .android.js files. */}
<Text>{this.state.text}</Text>
{/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was
* found when making Flow check .android.js files. */}
<Text>Content Size: {JSON.stringify(this.state.contentSize)}</Text>
</View>
);
@ -407,6 +441,8 @@ exports.examples = [
<TextInput
autoFocus={true}
multiline={true}
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was
* found when making Flow check .android.js files. */
style={styles.input}
accessibilityLabel="I am the accessibility label for text input"
/>
@ -801,6 +837,8 @@ exports.examples = [
return (
<View>
<SelectionExample
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was
* found when making Flow check .android.js files. */
style={styles.default}
value="text selection can be changed"
/>