Skip to content

Commit

Permalink
Flow Typing ActivityIndicator
Browse files Browse the repository at this point in the history
Reviewed By: yungsters

Differential Revision: D7977834

fbshipit-source-id: 62e54f98ee8f9e7d5189fc19c803a95f5c4c43aa
  • Loading branch information
elicwhite authored and facebook-github-bot committed May 12, 2018
1 parent f19ee28 commit 0b71d1d
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions Libraries/Components/ActivityIndicator/ActivityIndicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand All @@ -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],

Expand Down Expand Up @@ -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',
};
Expand Down Expand Up @@ -120,7 +132,7 @@ const ActivityIndicator = createReactClass({
</View>
);
},
});
}): any): React.ComponentType<Props>);

if (Platform.OS === 'ios') {
RCTActivityIndicator = requireNativeComponent(
Expand Down

0 comments on commit 0b71d1d

Please sign in to comment.