|
|
|
|
78
|
|
78
|
|
79
|
[CATransaction commit];
|
79
|
[CATransaction commit];
|
80
|
}
|
80
|
}
|
81
|
-
|
|
|
|
|
81
|
+
|
82
|
if ([vc isKindOfClass:[RNNSplitViewController class]]) {
|
82
|
if ([vc isKindOfClass:[RNNSplitViewController class]]) {
|
83
|
RNNSplitViewController* splitVc = (RNNSplitViewController*)vc;
|
83
|
RNNSplitViewController* splitVc = (RNNSplitViewController*)vc;
|
84
|
[splitVc.options mergeWith:options];
|
84
|
[splitVc.options mergeWith:options];
|
|
|
|
|
99
|
|
99
|
|
100
|
- (void)push:(NSString*)componentId layout:(NSDictionary*)layout completion:(RNNTransitionCompletionBlock)completion rejection:(RCTPromiseRejectBlock)rejection {
|
100
|
- (void)push:(NSString*)componentId layout:(NSDictionary*)layout completion:(RNNTransitionCompletionBlock)completion rejection:(RCTPromiseRejectBlock)rejection {
|
101
|
[self assertReady];
|
101
|
[self assertReady];
|
102
|
-
|
|
|
|
|
102
|
+
|
103
|
RNNRootViewController *newVc = (RNNRootViewController *)[_controllerFactory createLayoutAndSaveToStore:layout];
|
103
|
RNNRootViewController *newVc = (RNNRootViewController *)[_controllerFactory createLayoutAndSaveToStore:layout];
|
104
|
UIViewController *fromVC = [_store findComponentForId:componentId];
|
104
|
UIViewController *fromVC = [_store findComponentForId:componentId];
|
105
|
|
105
|
|
106
|
if (newVc.options.preview.elementId) {
|
106
|
if (newVc.options.preview.elementId) {
|
107
|
UIViewController* vc = [_store findComponentForId:componentId];
|
107
|
UIViewController* vc = [_store findComponentForId:componentId];
|
108
|
-
|
|
|
|
|
108
|
+
|
109
|
if([vc isKindOfClass:[RNNRootViewController class]]) {
|
109
|
if([vc isKindOfClass:[RNNRootViewController class]]) {
|
110
|
RNNRootViewController* rootVc = (RNNRootViewController*)vc;
|
110
|
RNNRootViewController* rootVc = (RNNRootViewController*)vc;
|
111
|
rootVc.previewController = newVc;
|
111
|
rootVc.previewController = newVc;
|
112
|
-
|
|
|
|
|
112
|
+
|
113
|
RNNElementFinder* elementFinder = [[RNNElementFinder alloc] initWithFromVC:vc];
|
113
|
RNNElementFinder* elementFinder = [[RNNElementFinder alloc] initWithFromVC:vc];
|
114
|
RNNElementView* elementView = [elementFinder findElementForId:newVc.options.preview.elementId];
|
114
|
RNNElementView* elementView = [elementFinder findElementForId:newVc.options.preview.elementId];
|
115
|
-
|
|
|
|
|
115
|
+
|
116
|
CGSize size = CGSizeMake(rootVc.view.frame.size.width, rootVc.view.frame.size.height);
|
116
|
CGSize size = CGSizeMake(rootVc.view.frame.size.width, rootVc.view.frame.size.height);
|
117
|
|
117
|
|
118
|
if (newVc.options.preview.width) {
|
118
|
if (newVc.options.preview.width) {
|
119
|
size.width = [newVc.options.preview.width floatValue];
|
119
|
size.width = [newVc.options.preview.width floatValue];
|
120
|
}
|
120
|
}
|
121
|
-
|
|
|
|
|
121
|
+
|
122
|
if (newVc.options.preview.height) {
|
122
|
if (newVc.options.preview.height) {
|
123
|
size.height = [newVc.options.preview.height floatValue];
|
123
|
size.height = [newVc.options.preview.height floatValue];
|
124
|
}
|
124
|
}
|
125
|
-
|
|
|
|
|
125
|
+
|
126
|
if (newVc.options.preview.width || newVc.options.preview.height) {
|
126
|
if (newVc.options.preview.width || newVc.options.preview.height) {
|
127
|
newVc.preferredContentSize = size;
|
127
|
newVc.preferredContentSize = size;
|
128
|
}
|
128
|
}
|
129
|
-
|
|
|
|
|
129
|
+
|
130
|
[rootVc registerForPreviewingWithDelegate:(id)rootVc sourceView:elementView];
|
130
|
[rootVc registerForPreviewingWithDelegate:(id)rootVc sourceView:elementView];
|
131
|
}
|
131
|
}
|
132
|
} else {
|
132
|
} else {
|
|
|
|
|
153
|
} rejection:rejection];
|
153
|
} rejection:rejection];
|
154
|
}
|
154
|
}
|
155
|
|
155
|
|
156
|
-- (void)pop:(NSString*)componentId options:(NSDictionary*)options completion:(RNNTransitionCompletionBlock)completion rejection:(RCTPromiseRejectBlock)rejection {
|
|
|
|
|
156
|
+- (void)pop:(NSString*)componentId options:(NSDictionary*)optionsDict completion:(RNNTransitionCompletionBlock)completion rejection:(RCTPromiseRejectBlock)rejection {
|
157
|
[self assertReady];
|
157
|
[self assertReady];
|
158
|
-
|
|
|
|
|
158
|
+
|
159
|
RNNRootViewController *vc = (RNNRootViewController*)[_store findComponentForId:componentId];
|
159
|
RNNRootViewController *vc = (RNNRootViewController*)[_store findComponentForId:componentId];
|
|
|
160
|
+ [vc.options mergeWith:optionsDict];
|
|
|
161
|
+
|
160
|
UINavigationController *nvc = vc.navigationController;
|
162
|
UINavigationController *nvc = vc.navigationController;
|
161
|
-
|
|
|
|
|
163
|
+
|
162
|
if ([nvc topViewController] == vc) {
|
164
|
if ([nvc topViewController] == vc) {
|
163
|
if (vc.options.animations.pop) {
|
165
|
if (vc.options.animations.pop) {
|
164
|
nvc.delegate = vc;
|
166
|
nvc.delegate = vc;
|
|
|
|
|
194
|
-(void) popToRoot:(NSString*)componentId completion:(RNNTransitionCompletionBlock)completion rejection:(RCTPromiseRejectBlock)rejection {
|
196
|
-(void) popToRoot:(NSString*)componentId completion:(RNNTransitionCompletionBlock)completion rejection:(RCTPromiseRejectBlock)rejection {
|
195
|
[self assertReady];
|
197
|
[self assertReady];
|
196
|
RNNRootViewController *newVc = (RNNRootViewController*)[_store findComponentForId:componentId];
|
198
|
RNNRootViewController *newVc = (RNNRootViewController*)[_store findComponentForId:componentId];
|
197
|
-
|
|
|
|
|
199
|
+
|
198
|
[CATransaction begin];
|
200
|
[CATransaction begin];
|
199
|
[CATransaction setCompletionBlock:^{
|
201
|
[CATransaction setCompletionBlock:^{
|
200
|
[_eventEmitter sendOnNavigationCommandCompletion:popToRoot params:@{@"componentId": componentId}];
|
202
|
[_eventEmitter sendOnNavigationCommandCompletion:popToRoot params:@{@"componentId": componentId}];
|
|
|
|
|
212
|
|
214
|
|
213
|
- (void)showModal:(NSDictionary*)layout completion:(RNNTransitionWithComponentIdCompletionBlock)completion {
|
215
|
- (void)showModal:(NSDictionary*)layout completion:(RNNTransitionWithComponentIdCompletionBlock)completion {
|
214
|
[self assertReady];
|
216
|
[self assertReady];
|
215
|
-
|
|
|
|
|
217
|
+
|
216
|
UIViewController<RNNRootViewProtocol> *newVc = [_controllerFactory createLayoutAndSaveToStore:layout];
|
218
|
UIViewController<RNNRootViewProtocol> *newVc = [_controllerFactory createLayoutAndSaveToStore:layout];
|
217
|
[_modalManager showModal:newVc animated:newVc.getLeafViewController.options.animations.showModal.enable completion:^(NSString *componentId) {
|
219
|
[_modalManager showModal:newVc animated:newVc.getLeafViewController.options.animations.showModal.enable completion:^(NSString *componentId) {
|
218
|
[_eventEmitter sendOnNavigationCommandCompletion:showModal params:@{@"layout": layout}];
|
220
|
[_eventEmitter sendOnNavigationCommandCompletion:showModal params:@{@"layout": layout}];
|
|
|
|
|
222
|
|
224
|
|
223
|
- (void)dismissModal:(NSString*)componentId completion:(RNNTransitionCompletionBlock)completion {
|
225
|
- (void)dismissModal:(NSString*)componentId completion:(RNNTransitionCompletionBlock)completion {
|
224
|
[self assertReady];
|
226
|
[self assertReady];
|
225
|
-
|
|
|
|
|
227
|
+
|
226
|
[CATransaction begin];
|
228
|
[CATransaction begin];
|
227
|
[CATransaction setCompletionBlock:^{
|
229
|
[CATransaction setCompletionBlock:^{
|
228
|
[_eventEmitter sendOnNavigationCommandCompletion:dismissModal params:@{@"componentId": componentId}];
|
230
|
[_eventEmitter sendOnNavigationCommandCompletion:dismissModal params:@{@"componentId": componentId}];
|
|
|
|
|
235
|
|
237
|
|
236
|
- (void)dismissAllModalsWithCompletion:(RNNTransitionCompletionBlock)completion {
|
238
|
- (void)dismissAllModalsWithCompletion:(RNNTransitionCompletionBlock)completion {
|
237
|
[self assertReady];
|
239
|
[self assertReady];
|
238
|
-
|
|
|
|
|
240
|
+
|
239
|
[CATransaction begin];
|
241
|
[CATransaction begin];
|
240
|
[CATransaction setCompletionBlock:^{
|
242
|
[CATransaction setCompletionBlock:^{
|
241
|
[_eventEmitter sendOnNavigationCommandCompletion:dismissAllModals params:@{}];
|
243
|
[_eventEmitter sendOnNavigationCommandCompletion:dismissAllModals params:@{}];
|
|
|
|
|
249
|
|
251
|
|
250
|
- (void)showOverlay:(NSDictionary *)layout completion:(RNNTransitionCompletionBlock)completion {
|
252
|
- (void)showOverlay:(NSDictionary *)layout completion:(RNNTransitionCompletionBlock)completion {
|
251
|
[self assertReady];
|
253
|
[self assertReady];
|
252
|
-
|
|
|
|
|
254
|
+
|
253
|
UIViewController<RNNRootViewProtocol>* overlayVC = [_controllerFactory createOverlay:layout];
|
255
|
UIViewController<RNNRootViewProtocol>* overlayVC = [_controllerFactory createOverlay:layout];
|
254
|
[_overlayManager showOverlay:overlayVC];
|
256
|
[_overlayManager showOverlay:overlayVC];
|
255
|
[_eventEmitter sendOnNavigationCommandCompletion:showOverlay params:@{@"layout": layout}];
|
257
|
[_eventEmitter sendOnNavigationCommandCompletion:showOverlay params:@{@"layout": layout}];
|