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:
Ramanpreet Nara 2021-05-12 14:14:36 -07:00 коммит произвёл Facebook GitHub Bot
Родитель 3c7809ed0d
Коммит a43d36578b
2 изменённых файлов: 8 добавлений и 10 удалений

Просмотреть файл

@ -34,7 +34,6 @@ using namespace facebook::react;
dispatch_block_t _initialMessageBlock; dispatch_block_t _initialMessageBlock;
} }
@synthesize bridge = _bridge;
@synthesize bundleManager = _bundleManager; @synthesize bundleManager = _bundleManager;
RCT_EXPORT_MODULE() RCT_EXPORT_MODULE()
@ -64,15 +63,6 @@ RCT_EXPORT_MODULE()
return YES; return YES;
} }
- (void)setBundleManager:(RCTBundleManager *)bundleManager
{
_bundleManager = bundleManager;
if (_bridge.loading) {
[self showWithURL:bundleManager.bundleURL];
}
}
- (void)clearInitialMessageDelay - (void)clearInitialMessageDelay
{ {
if (self->_initialMessageBlock != nil) { if (self->_initialMessageBlock != nil) {

Просмотреть файл

@ -495,6 +495,14 @@ struct RCTInstanceCallback : public InstanceCallback {
// Load the source asynchronously, then store it for later execution. // Load the source asynchronously, then store it for later execution.
dispatch_group_enter(prepareBridge); dispatch_group_enter(prepareBridge);
__block NSData *sourceCode; __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 [self
loadSource:^(NSError *error, RCTSource *source) { loadSource:^(NSError *error, RCTSource *source) {
if (error) { if (error) {