mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
fix(iOS): add extended check for content typeapplication/javascript (#43262)
Summary: When used with expo, JS code content type is `application/javascript; charset=UTF-8` instead of just `application/javascript`, We have a really large bundle and the application shows stuck at "Bundling 100%" and does not show "Downloading 1..100%". Here we improve the check for the content type to correctly show the progress. ## Changelog: [IOS] [FIXED] - Fixed headers content type check for iOS bundle download <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests Pull Request resolved: https://github.com/facebook/react-native/pull/43262 Reviewed By: huntie Differential Revision: D54412657 Pulled By: robhogan fbshipit-source-id: f12e260f1bda36495eb5e6ecd0f66c86f26d4747
This commit is contained in:
committed by
Facebook GitHub Bot
parent
571ef5660a
commit
d9b0f15c84
@@ -318,9 +318,11 @@ static void attemptAsynchronousLoadOfBundleAtURL(
|
||||
onComplete(nil, source);
|
||||
}
|
||||
progressHandler:^(NSDictionary *headers, NSNumber *loaded, NSNumber *total) {
|
||||
NSString *contentType = headers[@"Content-Type"];
|
||||
NSString *mimeType = [[contentType componentsSeparatedByString:@";"] firstObject];
|
||||
// Only care about download progress events for the javascript bundle part.
|
||||
if ([headers[@"Content-Type"] isEqualToString:@"application/javascript"] ||
|
||||
[headers[@"Content-Type"] isEqualToString:@"application/x-metro-bytecode-bundle"]) {
|
||||
if ([mimeType isEqualToString:@"application/javascript"] ||
|
||||
[mimeType isEqualToString:@"application/x-metro-bytecode-bundle"]) {
|
||||
onProgress(progressEventFromDownloadProgress(loaded, total));
|
||||
}
|
||||
}];
|
||||
|
||||
Reference in New Issue
Block a user