diff --git a/Libraries/Components/ActivityIndicator/ActivityIndicator.js b/Libraries/Components/ActivityIndicator/ActivityIndicator.js index 9bb86373165494..7d8b9cb77ce863 100644 --- a/Libraries/Components/ActivityIndicator/ActivityIndicator.js +++ b/Libraries/Components/ActivityIndicator/ActivityIndicator.js @@ -15,7 +15,7 @@ const React = require('React'); const StyleSheet = require('StyleSheet'); const View = require('View'); -const requireNativeComponent = require('requireNativeComponent'); +const RCTActivityIndicatorViewNativeComponent = require('RCTActivityIndicatorViewNativeComponent'); import type {NativeComponent} from 'ReactNative'; import type {ViewProps} from 'ViewPropTypes'; @@ -23,7 +23,7 @@ import type {ViewProps} from 'ViewPropTypes'; const RCTActivityIndicator = Platform.OS === 'android' ? require('ProgressBarAndroid') - : requireNativeComponent('RCTActivityIndicatorView'); + : RCTActivityIndicatorViewNativeComponent; const GRAY = '#999999'; @@ -69,10 +69,7 @@ type Props = $ReadOnly<{| * * See http://facebook.github.io/react-native/docs/activityindicator.html */ -const ActivityIndicator = ( - props: Props, - forwardedRef?: ?React.Ref<'RCTActivityIndicatorView'>, -) => { +const ActivityIndicator = (props: Props, forwardedRef?: any) => { const {onLayout, style, ...restProps} = props; let sizeStyle; diff --git a/Libraries/Components/ActivityIndicator/RCTActivityIndicatorViewNativeComponent.js b/Libraries/Components/ActivityIndicator/RCTActivityIndicatorViewNativeComponent.js new file mode 100644 index 00000000000000..461ee0e51d3392 --- /dev/null +++ b/Libraries/Components/ActivityIndicator/RCTActivityIndicatorViewNativeComponent.js @@ -0,0 +1,60 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + * @flow + */ + +'use strict'; + +const requireNativeComponent = require('requireNativeComponent'); + +import type {ViewProps} from 'ViewPropTypes'; +import type {ViewStyleProp} from 'StyleSheet'; +import type {NativeComponent} from 'ReactNative'; + +type NativeProps = $ReadOnly<{| + ...ViewProps, + + /** + * Whether the indicator should hide when not animating (true by default). + * + * See http://facebook.github.io/react-native/docs/activityindicator.html#hideswhenstopped + */ + hidesWhenStopped?: ?boolean, + + /** + * Whether to show the indicator (true, the default) or hide it (false). + * + * See http://facebook.github.io/react-native/docs/activityindicator.html#animating + */ + animating?: ?boolean, + + /** + * The foreground color of the spinner (default is gray). + * + * See http://facebook.github.io/react-native/docs/activityindicator.html#color + */ + color?: ?string, + + /** + * Size of the indicator (default is 'small'). + * Passing a number to the size prop is only supported on Android. + * + * See http://facebook.github.io/react-native/docs/activityindicator.html#size + */ + size?: ?(number | 'small' | 'large'), + + style?: ?ViewStyleProp, + styleAttr?: ?string, + indeterminate?: ?boolean, +|}>; + +type ActivityIndicatorNativeType = Class>; + +module.exports = ((requireNativeComponent( + 'RCTActivityIndicatorView', +): any): ActivityIndicatorNativeType);