mirror of
https://github.com/status-im/react-native.git
synced 2025-01-27 01:40:08 +00:00
Flow Typing ActivityIndicator
Reviewed By: yungsters Differential Revision: D7977834 fbshipit-source-id: 62e54f98ee8f9e7d5189fc19c803a95f5c4c43aa
This commit is contained in:
parent
f19ee28e7d
commit
0b71d1ddb0
@ -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(
|
||||
|
Loading…
x
Reference in New Issue
Block a user