From 0b71d1ddb03c036ed118574c105b0af505da19fc Mon Sep 17 00:00:00 2001 From: Eli White Date: Sat, 12 May 2018 10:25:12 -0700 Subject: [PATCH] Flow Typing ActivityIndicator Reviewed By: yungsters Differential Revision: D7977834 fbshipit-source-id: 62e54f98ee8f9e7d5189fc19c803a95f5c4c43aa --- .../ActivityIndicator/ActivityIndicator.js | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/Libraries/Components/ActivityIndicator/ActivityIndicator.js b/Libraries/Components/ActivityIndicator/ActivityIndicator.js index a3bf769f7..7438d1e35 100644 --- a/Libraries/Components/ActivityIndicator/ActivityIndicator.js +++ b/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({ ); }, -}); +}): any): React.ComponentType); if (Platform.OS === 'ios') { RCTActivityIndicator = requireNativeComponent(