Skip to content

Commit

Permalink
Refactor RCTActivityIndicator
Browse files Browse the repository at this point in the history
  • Loading branch information
Saadnajmi committed Sep 23, 2023
1 parent cec6410 commit aeaa593
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions packages/react-native/React/Base/RCTUIKit.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ enum : NSInteger

// RCTActivityIndicatorView.h
typedef NS_ENUM(NSInteger, UIActivityIndicatorViewStyle) {
UIActivityIndicatorViewStyleWhiteLarge,
UIActivityIndicatorViewStyleWhite
UIActivityIndicatorViewStyleLarge,
UIActivityIndicatorViewStyleMedium,
};


Expand Down
12 changes: 8 additions & 4 deletions packages/react-native/React/Base/macOS/RCTUIKit.m
Original file line number Diff line number Diff line change
Expand Up @@ -698,11 +698,15 @@ - (void)setActivityIndicatorViewStyle:(UIActivityIndicatorViewStyle)activityIndi
_activityIndicatorViewStyle = activityIndicatorViewStyle;

switch (activityIndicatorViewStyle) {
case UIActivityIndicatorViewStyleWhiteLarge:
self.controlSize = NSControlSizeRegular;
case UIActivityIndicatorViewStyleLarge:
if (@available(macOS 11.0, *)) {
self.controlSize = NSControlSizeLarge;
} else {
self.controlSize = NSControlSizeRegular;
}
break;
case UIActivityIndicatorViewStyleWhite:
self.controlSize = NSControlSizeSmall;
case UIActivityIndicatorViewStyleMedium:
self.controlSize = NSControlSizeRegular;
break;
default:
break;
Expand Down
4 changes: 2 additions & 2 deletions packages/react-native/React/Views/RCTActivityIndicatorView.m
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ - (void)setActivityIndicatorViewStyle:(UIActivityIndicatorViewStyle)activityIndi
_activityIndicatorViewStyle = activityIndicatorViewStyle;

switch (activityIndicatorViewStyle) {
case UIActivityIndicatorViewStyleWhiteLarge:
case UIActivityIndicatorViewStyleLarge:
self.controlSize = NSControlSizeRegular;
break;
case UIActivityIndicatorViewStyleWhite:
case UIActivityIndicatorViewStyleMedium:
self.controlSize = NSControlSizeSmall;
break;
default:
Expand Down

0 comments on commit aeaa593

Please sign in to comment.