Update ActivityIndicator size prop type

Summary:
This diff updates the flow types for the ActivityIndicator size prop.

The android component [here](diffusion/FBS/browse/master/xplat/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ReactProgressBarViewManager.java$31-30) does not use a size prop

The iOS component [here](diffusion/FBS/browse/master/xplat/js/react-native-github/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.mm;e82762cefe5cddad4a7e8144c42c76eb4d907e56$14-15,23) uses the size prop, but only for small/large, not for the number type

Reviewed By: TheSavior

Differential Revision: D14247432

fbshipit-source-id: 43b74574548eaf97f96d68c18ed627465fd5e133
This commit is contained in:
Rick Hanlon
2019-03-02 12:52:45 -08:00
committed by Facebook Github Bot
parent 9a2026beb9
commit 6e0f2bc8b3
2 changed files with 7 additions and 3 deletions

View File

@@ -70,15 +70,18 @@ type Props = $ReadOnly<{|
* See http://facebook.github.io/react-native/docs/activityindicator.html
*/
const ActivityIndicator = (props: Props, forwardedRef?: any) => {
const {onLayout, style, ...restProps} = props;
const {onLayout, style, size, ...restProps} = props;
let sizeStyle;
let sizeProp;
switch (props.size) {
switch (size) {
case 'small':
sizeStyle = styles.sizeSmall;
sizeProp = 'small';
break;
case 'large':
sizeStyle = styles.sizeLarge;
sizeProp = 'large';
break;
default:
sizeStyle = {height: props.size, width: props.size};
@@ -89,6 +92,7 @@ const ActivityIndicator = (props: Props, forwardedRef?: any) => {
...restProps,
ref: forwardedRef,
style: sizeStyle,
size: sizeProp,
styleAttr: 'Normal',
indeterminate: true,
};

View File

@@ -46,7 +46,7 @@ type NativeProps = $ReadOnly<{|
*
* See http://facebook.github.io/react-native/docs/activityindicator.html#size
*/
size?: ?(number | 'small' | 'large'),
size?: ?('small' | 'large'),
style?: ?ViewStyleProp,
styleAttr?: ?string,