|
@@ -49,11 +49,7 @@ RCT_EXPORT_METHOD(showModal:(NSDictionary*)layout)
|
49
|
49
|
RNNControllerFactory *factory = [[RNNControllerFactory alloc] initWithRootViewCreator:[RNNReactRootViewCreator new] store:[RNN instance].store];
|
50
|
50
|
UIViewController *newVc = [factory createLayoutAndSaveToStore:layout];
|
51
|
51
|
|
52
|
|
- UIViewController *root = UIApplication.sharedApplication.delegate.window.rootViewController;
|
53
|
|
- while(root.presentedViewController) {
|
54
|
|
- root = root.presentedViewController;
|
55
|
|
- }
|
56
|
|
-
|
|
52
|
+ UIViewController *root = [self topPresentedVC];
|
57
|
53
|
[root presentViewController:newVc animated:YES completion:^{
|
58
|
54
|
|
59
|
55
|
}];
|
|
@@ -63,14 +59,18 @@ RCT_EXPORT_METHOD(dismissModal:(NSString*)containerId)
|
63
|
59
|
{
|
64
|
60
|
UIViewController *root = [[RNN instance].store findContainerForId:containerId];
|
65
|
61
|
|
66
|
|
- // while(root.presentedViewController) {
|
67
|
|
- // root = root.presentedViewController;
|
68
|
|
- // }
|
69
|
62
|
if (root) {
|
|
63
|
+ UIViewController *topVC = [self topPresentedVC];
|
70
|
64
|
|
71
|
|
- [root dismissViewControllerAnimated:YES completion:^{
|
|
65
|
+ if (root == topVC) {
|
|
66
|
+ [root dismissViewControllerAnimated:YES completion:nil];
|
|
67
|
+ [[RNN instance].store.modalToDismiss dismissViewControllerAnimated:YES completion:nil];
|
|
68
|
+ [RNN instance].store.modalToDismiss = nil;
|
72
|
69
|
|
73
|
|
- }];
|
|
70
|
+ }
|
|
71
|
+ else {
|
|
72
|
+ [RNN instance].store.modalToDismiss = root;
|
|
73
|
+ }
|
74
|
74
|
}
|
75
|
75
|
}
|
76
|
76
|
|
|
@@ -81,5 +81,13 @@ RCT_EXPORT_METHOD(dismissModal:(NSString*)containerId)
|
81
|
81
|
}
|
82
|
82
|
}
|
83
|
83
|
|
|
84
|
+-(UIViewController*)topPresentedVC {
|
|
85
|
+ UIViewController *root = UIApplication.sharedApplication.delegate.window.rootViewController;
|
|
86
|
+ while(root.presentedViewController) {
|
|
87
|
+ root = root.presentedViewController;
|
|
88
|
+ }
|
|
89
|
+ return root;
|
|
90
|
+}
|
|
91
|
+
|
84
|
92
|
@end
|
85
|
93
|
|