[Fabric] Convert UIActivityIndicatorView to RCTActivityIndicatorView shim (#1528)

* [Fabric] Replace UIKit with RCTUIKit

* [Fabric] Convert UIActivityIndicatorView to RCTActivityIndicatorView shim

* Add macOS tags

* Shim RCTUIActivityIndicatorView instead of using RCTActivityIndicatorView

* Shim correct NSProgressIndicator

* Move RCTUIActivityIndicatorView below other defs for easier merges

Co-authored-by: Shawn Dempsey <shawndempsey@fb.com>
Co-authored-by: lyzhan7 <78454019+lyzhan7@users.noreply.github.com>
This commit is contained in:
Shawn Dempsey 2022-12-13 10:46:43 -08:00 коммит произвёл GitHub
Родитель 760a20de03
Коммит 6a7336a62b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 22 добавлений и 3 удалений

Просмотреть файл

@ -480,7 +480,7 @@ NS_INLINE CGRect CGRectValue(NSValue *value)
#else
@interface RCTUISlider : NSSlider
@end
#endif // ]TODO(macOS GH#774)
#endif // ]TODO(macOS GH#774)n
// RCTUILabel
@ -499,3 +499,21 @@ NS_INLINE CGRect CGRectValue(NSValue *value)
@interface RCTUISwitch : NSSwitch
@end
#endif // ]TODO(macOS GH#774)
// RCTUIActivityIndicatorView
#if !TARGET_OS_OSX // [TODO(macOS GH#774)
#define RCTUIActivityIndicatorView UIActivityIndicatorView
#else
@interface RCTUIActivityIndicatorView : NSProgressIndicator
@property (nonatomic, assign) UIActivityIndicatorViewStyle activityIndicatorViewStyle;
@property (nonatomic, assign) BOOL hidesWhenStopped;
@property (nullable, readwrite, nonatomic, strong) RCTUIColor *color;
@property (nonatomic, readonly, getter=isAnimating) BOOL animating;
- (void)startAnimating;
- (void)stopAnimating;
@end
#endif // ]TODO(macOS GH#774)

Просмотреть файл

@ -8,6 +8,7 @@
#import "RCTActivityIndicatorViewComponentView.h"
#import <React/RCTConversions.h>
#import <React/RCTActivityIndicatorView.h> // TODO(macOS GH#774)
#import <react/renderer/components/rncore/ComponentDescriptors.h>
#import <react/renderer/components/rncore/EventEmitters.h>
@ -28,7 +29,7 @@ static UIActivityIndicatorViewStyle convertActivityIndicatorViewStyle(const Acti
}
@implementation RCTActivityIndicatorViewComponentView {
UIActivityIndicatorView *_activityIndicatorView;
RCTUIActivityIndicatorView *_activityIndicatorView; // TODO(macOS GH#774)
}
#pragma mark - RCTComponentViewProtocol
@ -44,7 +45,7 @@ static UIActivityIndicatorViewStyle convertActivityIndicatorViewStyle(const Acti
static const auto defaultProps = std::make_shared<const ActivityIndicatorViewProps>();
_props = defaultProps;
_activityIndicatorView = [[UIActivityIndicatorView alloc] initWithFrame:self.bounds];
_activityIndicatorView = [[RCTUIActivityIndicatorView alloc] initWithFrame:self.bounds]; // TODO(macOS GH#774)
_activityIndicatorView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
if (defaultProps->animating) {