Skip to content

Commit e27542b

Browse files
rickhanloniifacebook-github-bot
authored andcommitted
Don't allow download percentage to exceed expectations
Summary: This diff updates the loading banner to protect against showing percentages over 100% Changelog: [Fixed] [iOS] Cap loading bar percentage at 100% Reviewed By: shergin Differential Revision: D21295809 fbshipit-source-id: 343f53acafa126800367444562730eff4ae67af4
1 parent 97bc084 commit e27542b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

React/Base/RCTJavaScriptLoader.mm

+3-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ - (NSString *)description
5252
NSMutableString *desc = [NSMutableString new];
5353
[desc appendString:_status ?: @"Bundling"];
5454

55-
if ([_total integerValue] > 0) {
55+
if ([_total integerValue] > 0 && [_done integerValue] > [_total integerValue]) {
56+
[desc appendFormat:@" %ld%%", (long)100];
57+
} else if ([_total integerValue] > 0) {
5658
[desc appendFormat:@" %ld%%", (long)(100 * [_done integerValue] / [_total integerValue])];
5759
} else {
5860
[desc appendFormat:@" %ld%%", (long)0];

0 commit comments

Comments
 (0)