mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
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
This commit is contained in:
committed by
Facebook GitHub Bot
parent
97bc0845ec
commit
e27542bb13
@@ -52,7 +52,9 @@ static RCTSource *RCTSourceCreate(NSURL *url, NSData *data, int64_t length) NS_R
|
||||
NSMutableString *desc = [NSMutableString new];
|
||||
[desc appendString:_status ?: @"Bundling"];
|
||||
|
||||
if ([_total integerValue] > 0) {
|
||||
if ([_total integerValue] > 0 && [_done integerValue] > [_total integerValue]) {
|
||||
[desc appendFormat:@" %ld%%", (long)100];
|
||||
} else if ([_total integerValue] > 0) {
|
||||
[desc appendFormat:@" %ld%%", (long)(100 * [_done integerValue] / [_total integerValue])];
|
||||
} else {
|
||||
[desc appendFormat:@" %ld%%", (long)0];
|
||||
|
||||
Reference in New Issue
Block a user