Daniel Zlotin 7 years ago
parent
commit
2b8f6bd9be
4 changed files with 11 additions and 11 deletions
  1. 6
    9
      ios/RNN.m
  2. 2
    1
      ios/RNNSplashScreen.h
  3. 1
    1
      ios/RNNSplashScreen.m
  4. 2
    0
      playground/ios/playground/Info.plist

+ 6
- 9
ios/RNN.m View File

@@ -40,8 +40,6 @@
40 40
 {
41 41
 	self.eventEmitter = [RNNEventEmitter new];
42 42
 	
43
-	self.store = [RNNStore new];
44
-	
45 43
 	UIApplication.sharedApplication.delegate.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
46 44
 	UIApplication.sharedApplication.delegate.window.backgroundColor = [UIColor whiteColor];
47 45
 	
@@ -59,11 +57,7 @@
59 57
 -(void)registerForJsEvents
60 58
 {
61 59
 	[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onJavaScriptLoaded) name:RCTJavaScriptDidLoadNotification object:self.bridge];
62
-	
63
-#pragma GCC diagnostic push
64
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
65
-//	[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onJavaScriptDevReload) name:RCTReloadNotification object:self.bridge];
66
-#pragma GCC diagnostic pop
60
+	[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onJavaScriptWillLoad) name:RCTJavaScriptWillStartLoadingNotification	object:self.bridge];
67 61
 }
68 62
 
69 63
 
@@ -74,10 +68,13 @@
74 68
 }
75 69
 
76 70
 
77
--(void)onJavaScriptDevReload
71
+-(void)onJavaScriptWillLoad
78 72
 {
79 73
 	self.store = [RNNStore new];
80
-	UIApplication.sharedApplication.delegate.window.rootViewController = nil;
74
+
75
+	if(![UIApplication.sharedApplication.delegate.window.rootViewController isKindOfClass:[RNNSplashScreen class]]) {
76
+		UIApplication.sharedApplication.delegate.window.rootViewController = nil;
77
+	}
81 78
 }
82 79
 
83 80
 

+ 2
- 1
ios/RNNSplashScreen.h View File

@@ -1,6 +1,7 @@
1 1
 #import <Foundation/Foundation.h>
2
+#import <UIKit/UIKit.h>
2 3
 
3
-@interface RNNSplashScreen : NSObject
4
+@interface RNNSplashScreen : UIViewController
4 5
 
5 6
 +(void)show;
6 7
 

+ 1
- 1
ios/RNNSplashScreen.m View File

@@ -63,7 +63,7 @@
63 63
 	
64 64
 	if (splashView != nil)
65 65
 	{
66
-		UIViewController *splashVC = [[UIViewController alloc] init];
66
+		RNNSplashScreen *splashVC = [[RNNSplashScreen alloc] init];
67 67
 		splashVC.view = splashView;
68 68
 		
69 69
 		id<UIApplicationDelegate> appDelegate = [UIApplication sharedApplication].delegate;

+ 2
- 0
playground/ios/playground/Info.plist View File

@@ -38,6 +38,8 @@
38 38
 	<key>UISupportedInterfaceOrientations</key>
39 39
 	<array>
40 40
 		<string>UIInterfaceOrientationPortrait</string>
41
+		<string>UIInterfaceOrientationLandscapeLeft</string>
42
+		<string>UIInterfaceOrientationLandscapeRight</string>
41 43
 	</array>
42 44
 	<key>UIViewControllerBasedStatusBarAppearance</key>
43 45
 	<true/>