Skip to content

Commit 43b2509

Browse files
sherginfacebook-github-bot
authored andcommittedDec 4, 2017
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
1 parent e9e0cd7 commit 43b2509

File tree

2 files changed

+5
-37
lines changed

2 files changed

+5
-37
lines changed
 

‎React/Base/Surface/RCTSurfaceView.h

-3
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,13 @@ NS_ASSUME_NONNULL_BEGIN
1313

1414
@class RCTSurface;
1515

16-
typedef UIView *(^RCTSurfaceActivityIndicatorViewFactory)();
17-
1816
/**
1917
* UIView instance which represents the Surface
2018
*/
2119
@interface RCTSurfaceView : UIView
2220

2321
- (instancetype)initWithSurface:(RCTSurface *)surface NS_DESIGNATED_INITIALIZER;
2422

25-
@property (nonatomic, copy, nullable) RCTSurfaceActivityIndicatorViewFactory activityIndicatorViewFactory;
2623
@property (nonatomic, weak, readonly, nullable) RCTSurface *surface;
2724

2825
@end

‎React/Base/Surface/RCTSurfaceView.mm

+5-34
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
@implementation RCTSurfaceView {
1818
RCTSurfaceRootView *_Nullable _rootView;
19-
UIView *_Nullable _activityIndicatorView;
2019
RCTSurfaceStage _stage;
2120
}
2221

@@ -44,30 +43,14 @@ - (void)setRootView:(RCTSurfaceRootView *)rootView
4443

4544
[_rootView removeFromSuperview];
4645
_rootView = rootView;
47-
[self updateStage];
46+
[self _updateStage];
4847
}
4948

5049
- (RCTSurfaceRootView *)rootView
5150
{
5251
return _rootView;
5352
}
5453

55-
#pragma mark - activityIndicatorView
56-
57-
- (void)setActivityIndicatorView:(UIView *)view
58-
{
59-
[_activityIndicatorView removeFromSuperview];
60-
_activityIndicatorView = view;
61-
_activityIndicatorView.frame = self.bounds;
62-
_activityIndicatorView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
63-
[self addSubview:_activityIndicatorView];
64-
}
65-
66-
- (UIView *)activityIndicatorView
67-
{
68-
return _activityIndicatorView;
69-
}
70-
7154
#pragma mark - stage
7255

7356
- (void)setStage:(RCTSurfaceStage)stage
@@ -78,38 +61,26 @@ - (void)setStage:(RCTSurfaceStage)stage
7861

7962
_stage = stage;
8063

81-
[self updateStage];
64+
[self _updateStage];
8265
}
8366

8467
- (RCTSurfaceStage)stage
8568
{
8669
return _stage;
8770
}
8871

89-
#pragma mark - Visibility
72+
#pragma mark - Private
9073

91-
- (void)updateStage
74+
- (void)_updateStage
9275
{
93-
BOOL displayRootView = _stage & RCTSurfaceStageSurfaceDidInitialLayout;
94-
BOOL displayActivityIndicator = !displayRootView;
95-
96-
if (displayRootView) {
76+
if (RCTSurfaceStageIsRunning(_stage)) {
9777
if (_rootView.superview != self) {
9878
[self addSubview:_rootView];
9979
}
10080
}
10181
else {
10282
[_rootView removeFromSuperview];
10383
}
104-
105-
if (displayActivityIndicator) {
106-
if (!_activityIndicatorView && self.activityIndicatorViewFactory != nil) {
107-
self.activityIndicatorView = self.activityIndicatorViewFactory();
108-
}
109-
}
110-
else {
111-
[_activityIndicatorView removeFromSuperview];
112-
}
11384
}
11485

11586
@end

0 commit comments

Comments
 (0)
Please sign in to comment.