|
@@ -10,6 +10,7 @@
|
10
|
10
|
@property (nonatomic) BOOL _statusBarHidden;
|
11
|
11
|
@property (nonatomic) BOOL isExternalComponent;
|
12
|
12
|
@property (nonatomic) BOOL _optionsApplied;
|
|
13
|
+@property (nonatomic, copy) void (^rotationBlock)(void);
|
13
|
14
|
@end
|
14
|
15
|
|
15
|
16
|
@implementation RNNRootViewController
|
|
@@ -19,7 +20,7 @@
|
19
|
20
|
withComponentId:(NSString*)componentId
|
20
|
21
|
rootViewCreator:(id<RNNRootViewCreator>)creator
|
21
|
22
|
eventEmitter:(RNNEventEmitter*)eventEmitter
|
22
|
|
- isExternalComponent:(BOOL)isExternalComponent {
|
|
23
|
+ isExternalComponent:(BOOL)isExternalComponent {
|
23
|
24
|
self = [super init];
|
24
|
25
|
self.componentId = componentId;
|
25
|
26
|
self.componentName = name;
|
|
@@ -28,7 +29,7 @@
|
28
|
29
|
self.animator = [[RNNAnimator alloc] initWithTransitionOptions:self.options.customTransition];
|
29
|
30
|
self.creator = creator;
|
30
|
31
|
self.isExternalComponent = isExternalComponent;
|
31
|
|
-
|
|
32
|
+
|
32
|
33
|
if (!self.isExternalComponent) {
|
33
|
34
|
self.view = [creator createRootView:self.componentName rootViewId:self.componentId];
|
34
|
35
|
}
|
|
@@ -38,7 +39,10 @@
|
38
|
39
|
name:RCTJavaScriptWillStartLoadingNotification
|
39
|
40
|
object:nil];
|
40
|
41
|
self.navigationController.delegate = self;
|
41
|
|
-
|
|
42
|
+ [[NSNotificationCenter defaultCenter] addObserver:self
|
|
43
|
+ selector:@selector(orientationDidChange:)
|
|
44
|
+ name:UIDeviceOrientationDidChangeNotification
|
|
45
|
+ object:nil];
|
42
|
46
|
return self;
|
43
|
47
|
}
|
44
|
48
|
|
|
@@ -199,6 +203,15 @@
|
199
|
203
|
[self.options.topTab applyOn:self];
|
200
|
204
|
}
|
201
|
205
|
|
|
206
|
+- (void)performOnRotation:(void (^)(void))block {
|
|
207
|
+ _rotationBlock = block;
|
|
208
|
+}
|
|
209
|
+
|
|
210
|
+- (void)orientationDidChange:(NSNotification*)notification {
|
|
211
|
+ if (_rotationBlock) {
|
|
212
|
+ _rotationBlock();
|
|
213
|
+ }
|
|
214
|
+}
|
202
|
215
|
|
203
|
216
|
/**
|
204
|
217
|
* fix for #877, #878
|