mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-01-12 22:50:10 +08:00
Fix RCTJavaScriptLoader loadBundleAtURL error case (#23837)
Summary:
Change the function called when an error is returned from the completionHandler of the `RCTJavaScriptLoader(loadBundleAtURL:onProgress:onComplete:)`.
* AS-IS
- `RCTLogError()`
- This error method does not post any notification for users. So users cannot receive notification when `RCTJavaScriptLoader(loadBundleAtURL:onProgress:onComplete:)` complete with error.(i.e. bundleURL is is invalid but not nil, `http://1`, `http://localho:8081/index.bundle`)
* TO-BE
- `handleError(error:)`
- Call this method will post notification for users when `completionHandler` fails with error.
[iOS] [Fixed] - Change the function called when an error is returned from the completionHandler of the `RCTJavaScriptLoader(loadBundleAtURL:onProgress:onComplete:)`.
Pull Request resolved: https://github.com/facebook/react-native/pull/23837
Differential Revision: D14538790
Pulled By: cpojer
fbshipit-source-id: da3306904c0d8113d204edfaa0f9e2a23793981a
This commit is contained in:
committed by
Facebook Github Bot
parent
02e8e531dd
commit
5dd6908b25
@@ -409,9 +409,10 @@ struct RCTInstanceCallback : public InstanceCallback {
|
||||
"server or have included a .jsbundle file in your application bundle.");
|
||||
onSourceLoad(error, nil);
|
||||
} else {
|
||||
__weak RCTCxxBridge *weakSelf = self;
|
||||
[RCTJavaScriptLoader loadBundleAtURL:self.bundleURL onProgress:onProgress onComplete:^(NSError *error, RCTSource *source) {
|
||||
if (error) {
|
||||
RCTLogError(@"Failed to load bundle(%@) with error:(%@ %@)", self.bundleURL, error.localizedDescription, error.localizedFailureReason);
|
||||
[weakSelf handleError:error];
|
||||
return;
|
||||
}
|
||||
onSourceLoad(error, source);
|
||||
|
||||
Reference in New Issue
Block a user