Skip to content

Commit f0dfd35

Browse files
rickhanloniifacebook-github-bot
authored andcommitted
Smaller loading bar based on feedback
Summary: This diff removes the hostname from the loading bar and shrinks it down so it's inside the margins of the safe area view, never blocking app content inside the safe area. Changelog: [General] [iOS] Shrink loading bar down to not cover safe area. Reviewed By: shergin Differential Revision: D21339480 fbshipit-source-id: e8416af63b7e06bcc21c7b6277d5d01d61eb3f73
1 parent 0569221 commit f0dfd35

File tree

1 file changed

+8
-23
lines changed

1 file changed

+8
-23
lines changed

React/CoreModules/RCTDevLoadingView.mm

+8-23
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ @interface RCTDevLoadingView () <NativeDevLoadingViewSpec>
2929
@implementation RCTDevLoadingView {
3030
UIWindow *_window;
3131
UILabel *_label;
32-
UILabel *_host;
3332
NSDate *_showDate;
3433
BOOL _hiding;
3534
dispatch_block_t _initialMessageBlock;
@@ -120,23 +119,14 @@ - (void)showMessage:(NSString *)message color:(UIColor *)color backgroundColor:(
120119
if (@available(iOS 11.0, *)) {
121120
UIWindow *window = RCTSharedApplication().keyWindow;
122121
self->_window =
123-
[[UIWindow alloc] initWithFrame:CGRectMake(0, 0, screenSize.width, window.safeAreaInsets.top + 52)];
124-
self->_label = [[UILabel alloc] initWithFrame:CGRectMake(0, window.safeAreaInsets.top, screenSize.width, 22)];
125-
self->_host =
126-
[[UILabel alloc] initWithFrame:CGRectMake(0, window.safeAreaInsets.top + 20, screenSize.width, 22)];
127-
self->_host.font = [UIFont monospacedDigitSystemFontOfSize:10.0 weight:UIFontWeightRegular];
128-
self->_host.textAlignment = NSTextAlignmentCenter;
129-
130-
[self->_window addSubview:self->_label];
131-
[self->_window addSubview:self->_host];
132-
122+
[[UIWindow alloc] initWithFrame:CGRectMake(0, 0, screenSize.width, window.safeAreaInsets.top + 10)];
123+
self->_label =
124+
[[UILabel alloc] initWithFrame:CGRectMake(0, window.safeAreaInsets.top - 10, screenSize.width, 20)];
133125
} else {
134-
self->_window = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, screenSize.width, 22)];
126+
self->_window = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, screenSize.width, 20)];
135127
self->_label = [[UILabel alloc] initWithFrame:self->_window.bounds];
136-
137-
[self->_window addSubview:self->_label];
138-
// TODO: Add host to iOS < 11.0
139128
}
129+
[self->_window addSubview:self->_label];
140130

141131
self->_window.windowLevel = UIWindowLevelStatusBar + 1;
142132
// set a root VC so rotation is supported
@@ -149,11 +139,6 @@ - (void)showMessage:(NSString *)message color:(UIColor *)color backgroundColor:(
149139
self->_label.text = message;
150140
self->_label.textColor = color;
151141

152-
if (self->_host != nil) {
153-
self->_host.text = [self getTextForHost];
154-
self->_host.textColor = [self dimColor:color];
155-
}
156-
157142
self->_window.backgroundColor = backgroundColor;
158143
self->_window.hidden = NO;
159144

@@ -186,11 +171,11 @@ - (void)showMessage:(NSString *)message color:(UIColor *)color backgroundColor:(
186171

187172
dispatch_async(dispatch_get_main_queue(), ^{
188173
self->_hiding = true;
189-
const NSTimeInterval MIN_PRESENTED_TIME = 0.5;
174+
const NSTimeInterval MIN_PRESENTED_TIME = 0.6;
190175
NSTimeInterval presentedTime = [[NSDate date] timeIntervalSinceDate:self->_showDate];
191176
NSTimeInterval delay = MAX(0, MIN_PRESENTED_TIME - presentedTime);
192177
CGRect windowFrame = self->_window.frame;
193-
[UIView animateWithDuration:0.1
178+
[UIView animateWithDuration:0.25
194179
delay:delay
195180
options:0
196181
animations:^{
@@ -216,7 +201,7 @@ - (void)showWithURL:(NSURL *)URL
216201
return;
217202
#endif
218203
color = [UIColor whiteColor];
219-
backgroundColor = [UIColor colorWithHue:105 saturation:0 brightness:.25 alpha:1];
204+
backgroundColor = [UIColor blackColor];
220205
message = [NSString stringWithFormat:@"Connect to %@ to develop JavaScript.", RCT_PACKAGER_NAME];
221206
[self showMessage:message color:color backgroundColor:backgroundColor];
222207
} else {

0 commit comments

Comments
 (0)