Skip to content

Commit e112934

Browse files
vzaidmanmeta-codesync[bot]
authored andcommitted
sync bundling progress between Metro cli and app hints (#55654)
Summary: Pull Request resolved: #55654 Changelog: [iOS][Fixed] sync bundling progress between Metro cli and app hints Reviewed By: hoxyq Differential Revision: D93737736 fbshipit-source-id: b468523758a31ce2c1cf96c478bd60915ff184b7
1 parent cd4a2bd commit e112934

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

packages/react-native/React/Base/RCTJavaScriptLoader.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ NS_ENUM(NSInteger){
3333
@property (nonatomic, copy) NSString *status;
3434
@property (strong, nonatomic) NSNumber *done;
3535
@property (strong, nonatomic) NSNumber *total;
36+
@property (strong, nonatomic) NSNumber *percent;
3637

3738
@end
3839

packages/react-native/React/Base/RCTJavaScriptLoader.mm

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ - (NSString *)description
5353
{
5454
NSMutableString *desc = [NSMutableString new];
5555
[desc appendString:_status ?: @"Bundling"];
56-
57-
if ([_total integerValue] > 0 && [_done integerValue] > [_total integerValue]) {
56+
if (_percent != nil) {
57+
[desc appendFormat:@" %ld%%", (long)[_percent integerValue]];
58+
} else if ([_total integerValue] > 0 && [_done integerValue] > [_total integerValue]) {
5859
[desc appendFormat:@" %ld%%", (long)100];
5960
} else if ([_total integerValue] > 0) {
6061
[desc appendFormat:@" %ld%%", (long)(100 * [_done integerValue] / [_total integerValue])];
@@ -348,6 +349,9 @@ static void attemptAsynchronousLoadOfBundleAtURL(
348349
progress.status = info[@"status"];
349350
progress.done = info[@"done"];
350351
progress.total = info[@"total"];
352+
if (info[@"percent"] != nil) {
353+
progress.percent = info[@"percent"];
354+
}
351355
return progress;
352356
}
353357

0 commit comments

Comments
 (0)