RCTSurface: activityIndicatorViewFactory was removed from RCTSurfaceView

Summary: Apparently we don't need this at this level. This will be implemented as part of RCTSufraceHostingView.

Reviewed By: rsnara

Differential Revision: D6367071

fbshipit-source-id: 71a2361b8a0c6594c63602165ce5e054de62630d
This commit is contained in:
Valentin Shergin 2017-12-03 20:03:29 -08:00 коммит произвёл Facebook Github Bot
Родитель e9e0cd7ab8
Коммит 43b2509320
2 изменённых файлов: 5 добавлений и 37 удалений

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

@ -13,8 +13,6 @@ NS_ASSUME_NONNULL_BEGIN
@class RCTSurface; @class RCTSurface;
typedef UIView *(^RCTSurfaceActivityIndicatorViewFactory)();
/** /**
* UIView instance which represents the Surface * UIView instance which represents the Surface
*/ */
@ -22,7 +20,6 @@ typedef UIView *(^RCTSurfaceActivityIndicatorViewFactory)();
- (instancetype)initWithSurface:(RCTSurface *)surface NS_DESIGNATED_INITIALIZER; - (instancetype)initWithSurface:(RCTSurface *)surface NS_DESIGNATED_INITIALIZER;
@property (nonatomic, copy, nullable) RCTSurfaceActivityIndicatorViewFactory activityIndicatorViewFactory;
@property (nonatomic, weak, readonly, nullable) RCTSurface *surface; @property (nonatomic, weak, readonly, nullable) RCTSurface *surface;
@end @end

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

@ -16,7 +16,6 @@
@implementation RCTSurfaceView { @implementation RCTSurfaceView {
RCTSurfaceRootView *_Nullable _rootView; RCTSurfaceRootView *_Nullable _rootView;
UIView *_Nullable _activityIndicatorView;
RCTSurfaceStage _stage; RCTSurfaceStage _stage;
} }
@ -44,7 +43,7 @@ RCT_NOT_IMPLEMENTED(- (nullable instancetype)initWithCoder:(NSCoder *)coder)
[_rootView removeFromSuperview]; [_rootView removeFromSuperview];
_rootView = rootView; _rootView = rootView;
[self updateStage]; [self _updateStage];
} }
- (RCTSurfaceRootView *)rootView - (RCTSurfaceRootView *)rootView
@ -52,22 +51,6 @@ RCT_NOT_IMPLEMENTED(- (nullable instancetype)initWithCoder:(NSCoder *)coder)
return _rootView; return _rootView;
} }
#pragma mark - activityIndicatorView
- (void)setActivityIndicatorView:(UIView *)view
{
[_activityIndicatorView removeFromSuperview];
_activityIndicatorView = view;
_activityIndicatorView.frame = self.bounds;
_activityIndicatorView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self addSubview:_activityIndicatorView];
}
- (UIView *)activityIndicatorView
{
return _activityIndicatorView;
}
#pragma mark - stage #pragma mark - stage
- (void)setStage:(RCTSurfaceStage)stage - (void)setStage:(RCTSurfaceStage)stage
@ -78,7 +61,7 @@ RCT_NOT_IMPLEMENTED(- (nullable instancetype)initWithCoder:(NSCoder *)coder)
_stage = stage; _stage = stage;
[self updateStage]; [self _updateStage];
} }
- (RCTSurfaceStage)stage - (RCTSurfaceStage)stage
@ -86,14 +69,11 @@ RCT_NOT_IMPLEMENTED(- (nullable instancetype)initWithCoder:(NSCoder *)coder)
return _stage; return _stage;
} }
#pragma mark - Visibility #pragma mark - Private
- (void)updateStage - (void)_updateStage
{ {
BOOL displayRootView = _stage & RCTSurfaceStageSurfaceDidInitialLayout; if (RCTSurfaceStageIsRunning(_stage)) {
BOOL displayActivityIndicator = !displayRootView;
if (displayRootView) {
if (_rootView.superview != self) { if (_rootView.superview != self) {
[self addSubview:_rootView]; [self addSubview:_rootView];
} }
@ -101,15 +81,6 @@ RCT_NOT_IMPLEMENTED(- (nullable instancetype)initWithCoder:(NSCoder *)coder)
else { else {
[_rootView removeFromSuperview]; [_rootView removeFromSuperview];
} }
if (displayActivityIndicator) {
if (!_activityIndicatorView && self.activityIndicatorViewFactory != nil) {
self.activityIndicatorView = self.activityIndicatorViewFactory();
}
}
else {
[_activityIndicatorView removeFromSuperview];
}
} }
@end @end