Skip to content

Commit

Permalink
ActivityIndicator (facebook#23104)
Browse files Browse the repository at this point in the history
Summary:
PR Related to: facebook#22990

Changelog:
[Android][Changed] - All the imports connected to requireNativeComponent in ActivityIndicator was moved to  a seperate file.
Pull Request resolved: facebook#23104

Differential Revision: D13781451

Pulled By: cpojer

fbshipit-source-id: 7204976d59a96abdaa81cdd7fd54fd001f7d1ee9
  • Loading branch information
VisibleMarkov authored and facebook-github-bot committed Jan 23, 2019
1 parent 815911d commit fd8e80a
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 6 deletions.
9 changes: 3 additions & 6 deletions Libraries/Components/ActivityIndicator/ActivityIndicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ 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';

const RCTActivityIndicator =
Platform.OS === 'android'
? require('ProgressBarAndroid')
: requireNativeComponent('RCTActivityIndicatorView');
: RCTActivityIndicatorViewNativeComponent;

const GRAY = '#999999';

Expand Down Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
@@ -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<NativeComponent<NativeProps>>;
module.exports = ((requireNativeComponent(
'RCTActivityIndicatorView',
): any): ActivityIndicatorNativeType);

0 comments on commit fd8e80a

Please sign in to comment.