diff --git a/React/Base/Surface/RCTSurfaceView.h b/React/Base/Surface/RCTSurfaceView.h index 7f90e188e6..030cdcf437 100644 --- a/React/Base/Surface/RCTSurfaceView.h +++ b/React/Base/Surface/RCTSurfaceView.h @@ -13,8 +13,6 @@ NS_ASSUME_NONNULL_BEGIN @class RCTSurface; -typedef UIView *(^RCTSurfaceActivityIndicatorViewFactory)(); - /** * UIView instance which represents the Surface */ @@ -22,7 +20,6 @@ typedef UIView *(^RCTSurfaceActivityIndicatorViewFactory)(); - (instancetype)initWithSurface:(RCTSurface *)surface NS_DESIGNATED_INITIALIZER; -@property (nonatomic, copy, nullable) RCTSurfaceActivityIndicatorViewFactory activityIndicatorViewFactory; @property (nonatomic, weak, readonly, nullable) RCTSurface *surface; @end diff --git a/React/Base/Surface/RCTSurfaceView.mm b/React/Base/Surface/RCTSurfaceView.mm index ce3b59645c..b062c1aff6 100644 --- a/React/Base/Surface/RCTSurfaceView.mm +++ b/React/Base/Surface/RCTSurfaceView.mm @@ -16,7 +16,6 @@ @implementation RCTSurfaceView { RCTSurfaceRootView *_Nullable _rootView; - UIView *_Nullable _activityIndicatorView; RCTSurfaceStage _stage; } @@ -44,7 +43,7 @@ RCT_NOT_IMPLEMENTED(- (nullable instancetype)initWithCoder:(NSCoder *)coder) [_rootView removeFromSuperview]; _rootView = rootView; - [self updateStage]; + [self _updateStage]; } - (RCTSurfaceRootView *)rootView @@ -52,22 +51,6 @@ RCT_NOT_IMPLEMENTED(- (nullable instancetype)initWithCoder:(NSCoder *)coder) 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 - (void)setStage:(RCTSurfaceStage)stage @@ -78,7 +61,7 @@ RCT_NOT_IMPLEMENTED(- (nullable instancetype)initWithCoder:(NSCoder *)coder) _stage = stage; - [self updateStage]; + [self _updateStage]; } - (RCTSurfaceStage)stage @@ -86,14 +69,11 @@ RCT_NOT_IMPLEMENTED(- (nullable instancetype)initWithCoder:(NSCoder *)coder) return _stage; } -#pragma mark - Visibility +#pragma mark - Private -- (void)updateStage +- (void)_updateStage { - BOOL displayRootView = _stage & RCTSurfaceStageSurfaceDidInitialLayout; - BOOL displayActivityIndicator = !displayRootView; - - if (displayRootView) { + if (RCTSurfaceStageIsRunning(_stage)) { if (_rootView.superview != self) { [self addSubview:_rootView]; } @@ -101,15 +81,6 @@ RCT_NOT_IMPLEMENTED(- (nullable instancetype)initWithCoder:(NSCoder *)coder) else { [_rootView removeFromSuperview]; } - - if (displayActivityIndicator) { - if (!_activityIndicatorView && self.activityIndicatorViewFactory != nil) { - self.activityIndicatorView = self.activityIndicatorViewFactory(); - } - } - else { - [_activityIndicatorView removeFromSuperview]; - } } @end