Skip to content

Commit 3729fe8

Browse files
rickhanloniifacebook-github-bot
authored andcommitted
Update loading banner text and colors
Summary: This diff updates the loading banner text and color on iOS for better UX. Flow before: - Loading from localhost:8081... - Loading 20% (1000/5000)... - Downloading JavaScript Bundle 20% (10/50) - Downloading JavaScript Bundle... After: - Loading from Metro... - Bundling 20%... - Downloading 20%... - Downloading... Changelog: [Added] [iOS] Updated loading banner messages and color Reviewed By: PeteTheHeat Differential Revision: D21279939 fbshipit-source-id: fd7d90f85e25ce175a87087dfccf2180d49e3e98
1 parent 9699933 commit 3729fe8

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

Libraries/Utilities/LoadingView.ios.js

+6-7
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,19 @@ import NativeDevLoadingView from './NativeDevLoadingView';
1616
module.exports = {
1717
showMessage(message: string, type: 'load' | 'refresh') {
1818
if (NativeDevLoadingView) {
19-
const green = processColor('#005a00');
20-
const blue = processColor('#2584e8');
19+
const loadColor = processColor('#404040');
20+
const refreshColor = processColor('#2584e8');
2121
const white = processColor('#ffffff');
2222

2323
NativeDevLoadingView.showMessage(
2424
message,
25-
// Use same colors as iOS "Personal Hotspot" bar.
2625
typeof white === 'number' ? white : null,
2726
type && type === 'load'
28-
? typeof green === 'number'
29-
? green
27+
? typeof loadColor === 'number'
28+
? loadColor
3029
: null
31-
: typeof blue === 'number'
32-
? blue
30+
: typeof refreshColor === 'number'
31+
? refreshColor
3332
: null,
3433
);
3534
}

React/Base/RCTJavaScriptLoader.mm

+5-3
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,12 @@ @implementation RCTLoadingProgress
5050
- (NSString *)description
5151
{
5252
NSMutableString *desc = [NSMutableString new];
53-
[desc appendString:_status ?: @"Loading"];
53+
[desc appendString:_status ?: @"Bundling"];
5454

5555
if ([_total integerValue] > 0) {
56-
[desc appendFormat:@" %ld%% (%@/%@)", (long)(100 * [_done integerValue] / [_total integerValue]), _done, _total];
56+
[desc appendFormat:@" %ld%%", (long)(100 * [_done integerValue] / [_total integerValue])];
57+
} else {
58+
[desc appendFormat:@" %ld%%", (long)0];
5759
}
5860
[desc appendString:@"\u2026"];
5961
return desc;
@@ -346,7 +348,7 @@ static void attemptAsynchronousLoadOfBundleAtURL(
346348
static RCTLoadingProgress *progressEventFromDownloadProgress(NSNumber *total, NSNumber *done)
347349
{
348350
RCTLoadingProgress *progress = [RCTLoadingProgress new];
349-
progress.status = @"Downloading JavaScript bundle";
351+
progress.status = @"Downloading";
350352
// Progress values are in bytes transform them to kilobytes for smaller numbers.
351353
progress.done = done != nil ? @([done integerValue] / 1024) : nil;
352354
progress.total = total != nil ? @([total integerValue] / 1024) : nil;

React/CoreModules/RCTDevLoadingView.mm

+3-4
Original file line numberDiff line numberDiff line change
@@ -188,14 +188,13 @@ - (void)showWithURL:(NSURL *)URL
188188
return;
189189
#endif
190190
color = [UIColor whiteColor];
191-
backgroundColor = [UIColor blackColor];
191+
backgroundColor = [UIColor colorWithHue:105 saturation:0 brightness:.25 alpha:1];
192192
message = [NSString stringWithFormat:@"Connect to %@ to develop JavaScript.", RCT_PACKAGER_NAME];
193193
} else {
194194
color = [UIColor whiteColor];
195-
backgroundColor = [UIColor colorWithHue:1. / 3 saturation:1 brightness:.35 alpha:1];
196-
message = [NSString stringWithFormat:@"Loading from %@:%@...", URL.host, URL.port];
195+
backgroundColor = [UIColor colorWithHue:105 saturation:0 brightness:.25 alpha:1];
196+
message = [NSString stringWithFormat:@"Loading from %@\u2026", RCT_PACKAGER_NAME];
197197
}
198-
199198
[self showMessage:message color:color backgroundColor:backgroundColor];
200199
}
201200

0 commit comments

Comments
 (0)