Skip to content

Commit 6e0f2bc

Browse files
rickhanloniifacebook-github-bot
authored andcommitted
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
1 parent 9a2026b commit 6e0f2bc

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Libraries/Components/ActivityIndicator/ActivityIndicator.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,18 @@ type Props = $ReadOnly<{|
7070
* See http://facebook.github.io/react-native/docs/activityindicator.html
7171
*/
7272
const ActivityIndicator = (props: Props, forwardedRef?: any) => {
73-
const {onLayout, style, ...restProps} = props;
73+
const {onLayout, style, size, ...restProps} = props;
7474
let sizeStyle;
75+
let sizeProp;
7576

76-
switch (props.size) {
77+
switch (size) {
7778
case 'small':
7879
sizeStyle = styles.sizeSmall;
80+
sizeProp = 'small';
7981
break;
8082
case 'large':
8183
sizeStyle = styles.sizeLarge;
84+
sizeProp = 'large';
8285
break;
8386
default:
8487
sizeStyle = {height: props.size, width: props.size};
@@ -89,6 +92,7 @@ const ActivityIndicator = (props: Props, forwardedRef?: any) => {
8992
...restProps,
9093
ref: forwardedRef,
9194
style: sizeStyle,
95+
size: sizeProp,
9296
styleAttr: 'Normal',
9397
indeterminate: true,
9498
};

Libraries/Components/ActivityIndicator/RCTActivityIndicatorViewNativeComponent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ type NativeProps = $ReadOnly<{|
4646
*
4747
* See http://facebook.github.io/react-native/docs/activityindicator.html#size
4848
*/
49-
size?: ?(number | 'small' | 'large'),
49+
size?: ?('small' | 'large'),
5050

5151
style?: ?ViewStyleProp,
5252
styleAttr?: ?string,

0 commit comments

Comments
 (0)