Skip to content

Commit 0b71d1d

Browse files
elicwhitefacebook-github-bot
authored andcommitted
Flow Typing ActivityIndicator
Reviewed By: yungsters Differential Revision: D7977834 fbshipit-source-id: 62e54f98ee8f9e7d5189fc19c803a95f5c4c43aa
1 parent f19ee28 commit 0b71d1d

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

Libraries/Components/ActivityIndicator/ActivityIndicator.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,27 @@ const ViewPropTypes = require('ViewPropTypes');
2222

2323
const createReactClass = require('create-react-class');
2424
const requireNativeComponent = require('requireNativeComponent');
25+
26+
import type {ViewProps} from 'ViewPropTypes';
27+
2528
let RCTActivityIndicator;
2629

2730
const GRAY = '#999999';
2831

2932
type IndicatorSize = number | 'small' | 'large';
3033

34+
type Props = $ReadOnly<{|
35+
...ViewProps,
36+
37+
animating?: ?boolean,
38+
color?: ?string,
39+
hidesWhenStopped?: ?boolean,
40+
size?: ?IndicatorSize,
41+
|}>;
42+
3143
type DefaultProps = {
3244
animating: boolean,
33-
color: any,
45+
color: ?string,
3446
hidesWhenStopped: boolean,
3547
size: IndicatorSize,
3648
};
@@ -40,7 +52,7 @@ type DefaultProps = {
4052
*
4153
* See http://facebook.github.io/react-native/docs/activityindicator.html
4254
*/
43-
const ActivityIndicator = createReactClass({
55+
const ActivityIndicator = ((createReactClass({
4456
displayName: 'ActivityIndicator',
4557
mixins: [NativeMethodsMixin],
4658

@@ -81,7 +93,7 @@ const ActivityIndicator = createReactClass({
8193
getDefaultProps(): DefaultProps {
8294
return {
8395
animating: true,
84-
color: Platform.OS === 'ios' ? GRAY : undefined,
96+
color: Platform.OS === 'ios' ? GRAY : null,
8597
hidesWhenStopped: true,
8698
size: 'small',
8799
};
@@ -120,7 +132,7 @@ const ActivityIndicator = createReactClass({
120132
</View>
121133
);
122134
},
123-
});
135+
}): any): React.ComponentType<Props>);
124136

125137
if (Platform.OS === 'ios') {
126138
RCTActivityIndicator = requireNativeComponent(

0 commit comments

Comments
 (0)