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
 {
40
 {
41
 	self.eventEmitter = [RNNEventEmitter new];
41
 	self.eventEmitter = [RNNEventEmitter new];
42
 	
42
 	
43
-	self.store = [RNNStore new];
44
-	
45
 	UIApplication.sharedApplication.delegate.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
43
 	UIApplication.sharedApplication.delegate.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
46
 	UIApplication.sharedApplication.delegate.window.backgroundColor = [UIColor whiteColor];
44
 	UIApplication.sharedApplication.delegate.window.backgroundColor = [UIColor whiteColor];
47
 	
45
 	
59
 -(void)registerForJsEvents
57
 -(void)registerForJsEvents
60
 {
58
 {
61
 	[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onJavaScriptLoaded) name:RCTJavaScriptDidLoadNotification object:self.bridge];
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
 }
68
 }
75
 
69
 
76
 
70
 
77
--(void)onJavaScriptDevReload
71
+-(void)onJavaScriptWillLoad
78
 {
72
 {
79
 	self.store = [RNNStore new];
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
 #import <Foundation/Foundation.h>
1
 #import <Foundation/Foundation.h>
2
+#import <UIKit/UIKit.h>
2
 
3
 
3
-@interface RNNSplashScreen : NSObject
4
+@interface RNNSplashScreen : UIViewController
4
 
5
 
5
 +(void)show;
6
 +(void)show;
6
 
7
 

+ 1
- 1
ios/RNNSplashScreen.m View File

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

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

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