mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-02-05 22:47:48 +08:00
[ReactNative] Prevent RCTDevLoadingView from creating UIWindow on unit tests
Summary: `RCTDevLoadingView` was being created from a constructor function and creating a `UIWindow` when the bridge started loading. The `UIWindow` was crashing on the unit tests since there's no host app.
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#import "RCTBridge.h"
|
||||
#import "RCTDevLoadingView.h"
|
||||
#import "RCTDefines.h"
|
||||
#import "RCTUtils.h"
|
||||
|
||||
#if RCT_DEV
|
||||
|
||||
@@ -40,7 +41,7 @@ static void RCTDevLoadingViewSetup()
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
if (self = [super init]) {
|
||||
if ((self = [super init]) && !RCTRunningInTestEnvironment()) {
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(willStartLoading:)
|
||||
name:RCTJavaScriptWillStartLoadingNotification
|
||||
|
||||
Reference in New Issue
Block a user