Migrate RCTDevLoadingView off bridge APIs
Summary: When RCTDevLoadingView is created, it checks to see if the bridge is loading. If so, displays the loading banner with the bundleURL. This logic is better placed in the bridge, because the bridge is also responsible for updating progress on the DevLoadingView. Changelog: [Internal] Reviewed By: fkgozali Differential Revision: D28301524 fbshipit-source-id: fb6c259b546d8cd9e08568a88c7046d06c70ed6f
This commit is contained in:
Родитель
3c7809ed0d
Коммит
a43d36578b
|
@ -34,7 +34,6 @@ using namespace facebook::react;
|
|||
dispatch_block_t _initialMessageBlock;
|
||||
}
|
||||
|
||||
@synthesize bridge = _bridge;
|
||||
@synthesize bundleManager = _bundleManager;
|
||||
|
||||
RCT_EXPORT_MODULE()
|
||||
|
@ -64,15 +63,6 @@ RCT_EXPORT_MODULE()
|
|||
return YES;
|
||||
}
|
||||
|
||||
- (void)setBundleManager:(RCTBundleManager *)bundleManager
|
||||
{
|
||||
_bundleManager = bundleManager;
|
||||
|
||||
if (_bridge.loading) {
|
||||
[self showWithURL:bundleManager.bundleURL];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)clearInitialMessageDelay
|
||||
{
|
||||
if (self->_initialMessageBlock != nil) {
|
||||
|
|
|
@ -495,6 +495,14 @@ struct RCTInstanceCallback : public InstanceCallback {
|
|||
// Load the source asynchronously, then store it for later execution.
|
||||
dispatch_group_enter(prepareBridge);
|
||||
__block NSData *sourceCode;
|
||||
|
||||
#if (RCT_DEV | RCT_ENABLE_LOADING_VIEW) && __has_include(<React/RCTDevLoadingViewProtocol.h>)
|
||||
{
|
||||
id<RCTDevLoadingViewProtocol> loadingView = [self moduleForName:@"DevLoadingView" lazilyLoadIfNecessary:YES];
|
||||
[loadingView showWithURL:self.bundleURL];
|
||||
}
|
||||
#endif
|
||||
|
||||
[self
|
||||
loadSource:^(NSError *error, RCTSource *source) {
|
||||
if (error) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче