react-native/RNTester/js/ProgressBarAndroidExample.android.js
Jordan Brown f125815efc 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
2018-08-13 11:16:41 -07:00

79 lines
2.2 KiB
JavaScript

/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
*/
'use strict';
var ProgressBar = require('ProgressBarAndroid');
var React = require('React');
var createReactClass = require('create-react-class');
var RNTesterBlock = require('RNTesterBlock');
var RNTesterPage = require('RNTesterPage');
var TimerMixin = require('react-timer-mixin');
var MovingBar = createReactClass({
displayName: 'MovingBar',
mixins: [TimerMixin],
getInitialState: function() {
return {
progress: 0,
};
},
componentDidMount: function() {
this.setInterval(() => {
var progress = (this.state.progress + 0.02) % 1;
this.setState({progress: progress});
}, 50);
},
render: function() {
return <ProgressBar progress={this.state.progress} {...this.props} />;
},
});
class ProgressBarAndroidExample extends React.Component<{}> {
static title = '<ProgressBarAndroid>';
static description = 'Horizontal bar to show the progress of some operation.';
render() {
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>
<RNTesterBlock title="Horizontal ProgressBar">
<MovingBar styleAttr="Horizontal" indeterminate={false} />
</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>
<RNTesterBlock title="Horizontal Blue ProgressBar">
<MovingBar
styleAttr="Horizontal"
indeterminate={false}
color="blue"
/>
</RNTesterBlock>
</RNTesterPage>
);
}
}
module.exports = ProgressBarAndroidExample;