Permalink
Browse files

Flow Typing ActivityIndicator

Reviewed By: yungsters

Differential Revision: D7977834

fbshipit-source-id: 62e54f98ee8f9e7d5189fc19c803a95f5c4c43aa
  • Loading branch information...
TheSavior authored and facebook-github-bot committed May 12, 2018
1 parent f19ee28 commit 0b71d1ddb03c036ed118574c105b0af505da19fc
Showing with 16 additions and 4 deletions.
  1. +16 −4 Libraries/Components/ActivityIndicator/ActivityIndicator.js
@@ -22,15 +22,27 @@ const ViewPropTypes = require('ViewPropTypes');
const createReactClass = require('create-react-class');
const requireNativeComponent = require('requireNativeComponent');
import type {ViewProps} from 'ViewPropTypes';
let RCTActivityIndicator;
const GRAY = '#999999';
type IndicatorSize = number | 'small' | 'large';
type Props = $ReadOnly<{|
...ViewProps,
animating?: ?boolean,
color?: ?string,
hidesWhenStopped?: ?boolean,
size?: ?IndicatorSize,
|}>;
type DefaultProps = {
animating: boolean,
color: any,
color: ?string,
hidesWhenStopped: boolean,
size: IndicatorSize,
};
@@ -40,7 +52,7 @@ type DefaultProps = {
*
* See http://facebook.github.io/react-native/docs/activityindicator.html
*/
const ActivityIndicator = createReactClass({
const ActivityIndicator = ((createReactClass({
displayName: 'ActivityIndicator',
mixins: [NativeMethodsMixin],
@@ -81,7 +93,7 @@ const ActivityIndicator = createReactClass({
getDefaultProps(): DefaultProps {
return {
animating: true,
color: Platform.OS === 'ios' ? GRAY : undefined,
color: Platform.OS === 'ios' ? GRAY : null,
hidesWhenStopped: true,
size: 'small',
};
@@ -120,7 +132,7 @@ const ActivityIndicator = createReactClass({
</View>
);
},
});
}): any): React.ComponentType<Props>);
if (Platform.OS === 'ios') {
RCTActivityIndicator = requireNativeComponent(

0 comments on commit 0b71d1d

Please sign in to comment.