[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:
Tadeu Zagallo
2015-07-30 03:02:57 -07:00
parent 8a272bc873
commit cf22111cee

View File

@@ -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