|
@@ -37,7 +37,7 @@
|
37
|
37
|
if (!self.isExternalComponent) {
|
38
|
38
|
self.view = [creator createRootView:self.componentName rootViewId:self.componentId];
|
39
|
39
|
}
|
40
|
|
-
|
|
40
|
+
|
41
|
41
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
42
|
42
|
selector:@selector(onJsReload)
|
43
|
43
|
name:RCTJavaScriptWillStartLoadingNotification
|
|
@@ -81,7 +81,8 @@
|
81
|
81
|
}
|
82
|
82
|
|
83
|
83
|
- (void)applyModalOptions {
|
84
|
|
- [self.options applyModalOptions:self];
|
|
84
|
+ [self.options applyOn:self];
|
|
85
|
+ [self.options applyModalOptions:self];
|
85
|
86
|
}
|
86
|
87
|
|
87
|
88
|
- (void)mergeOptions:(NSDictionary *)options {
|
|
@@ -100,12 +101,12 @@
|
100
|
101
|
} if ([self.navigationItem.title isKindOfClass:[RNNCustomTitleView class]] && !_customTitleView) {
|
101
|
102
|
self.navigationItem.title = nil;
|
102
|
103
|
}
|
103
|
|
- } else if (_customTitleView && _customTitleView.superview == nil) {
|
104
|
|
- if ([self.navigationItem.title isKindOfClass:[RNNCustomTitleView class]] && !_customTitleView) {
|
105
|
|
- self.navigationItem.title = nil;
|
106
|
|
- }
|
107
|
|
- self.navigationItem.titleView = _customTitleView;
|
108
|
|
- }
|
|
104
|
+ } else if (_customTitleView && _customTitleView.superview == nil) {
|
|
105
|
+ if ([self.navigationItem.title isKindOfClass:[RNNCustomTitleView class]] && !_customTitleView) {
|
|
106
|
+ self.navigationItem.title = nil;
|
|
107
|
+ }
|
|
108
|
+ self.navigationItem.titleView = _customTitleView;
|
|
109
|
+ }
|
109
|
110
|
}
|
110
|
111
|
|
111
|
112
|
- (void)setCustomNavigationBarView {
|
|
@@ -120,12 +121,12 @@
|
120
|
121
|
} else if ([[self.navigationController.navigationBar.subviews lastObject] isKindOfClass:[RNNCustomTitleView class]] && !_customTopBar) {
|
121
|
122
|
[[self.navigationController.navigationBar.subviews lastObject] removeFromSuperview];
|
122
|
123
|
}
|
123
|
|
- } else if (_customTopBar && _customTopBar.superview == nil) {
|
124
|
|
- if ([[self.navigationController.navigationBar.subviews lastObject] isKindOfClass:[RNNCustomTitleView class]] && !_customTopBar) {
|
125
|
|
- [[self.navigationController.navigationBar.subviews lastObject] removeFromSuperview];
|
126
|
|
- }
|
127
|
|
- [self.navigationController.navigationBar addSubview:_customTopBar];
|
128
|
|
- }
|
|
124
|
+ } else if (_customTopBar && _customTopBar.superview == nil) {
|
|
125
|
+ if ([[self.navigationController.navigationBar.subviews lastObject] isKindOfClass:[RNNCustomTitleView class]] && !_customTopBar) {
|
|
126
|
+ [[self.navigationController.navigationBar.subviews lastObject] removeFromSuperview];
|
|
127
|
+ }
|
|
128
|
+ [self.navigationController.navigationBar addSubview:_customTopBar];
|
|
129
|
+ }
|
129
|
130
|
}
|
130
|
131
|
|
131
|
132
|
- (void)setCustomNavigationComponentBackground {
|
|
@@ -140,13 +141,13 @@
|
140
|
141
|
[[self.navigationController.navigationBar.subviews objectAtIndex:1] removeFromSuperview];
|
141
|
142
|
self.navigationController.navigationBar.clipsToBounds = NO;
|
142
|
143
|
}
|
143
|
|
- } if (_customTopBarBackground && _customTopBarBackground.superview == nil) {
|
144
|
|
- if ([[self.navigationController.navigationBar.subviews objectAtIndex:1] isKindOfClass:[RNNCustomTitleView class]]) {
|
145
|
|
- [[self.navigationController.navigationBar.subviews objectAtIndex:1] removeFromSuperview];
|
146
|
|
- }
|
147
|
|
- [self.navigationController.navigationBar insertSubview:_customTopBarBackground atIndex:1];
|
148
|
|
- self.navigationController.navigationBar.clipsToBounds = YES;
|
149
|
|
- }
|
|
144
|
+ } if (_customTopBarBackground && _customTopBarBackground.superview == nil) {
|
|
145
|
+ if ([[self.navigationController.navigationBar.subviews objectAtIndex:1] isKindOfClass:[RNNCustomTitleView class]]) {
|
|
146
|
+ [[self.navigationController.navigationBar.subviews objectAtIndex:1] removeFromSuperview];
|
|
147
|
+ }
|
|
148
|
+ [self.navigationController.navigationBar insertSubview:_customTopBarBackground atIndex:1];
|
|
149
|
+ self.navigationController.navigationBar.clipsToBounds = YES;
|
|
150
|
+ }
|
150
|
151
|
}
|
151
|
152
|
|
152
|
153
|
-(BOOL)isCustomTransitioned {
|
|
@@ -163,7 +164,7 @@
|
163
|
164
|
} else if ([self.options.statusBar.hideWithTopBar boolValue]) {
|
164
|
165
|
return self.navigationController.isNavigationBarHidden;
|
165
|
166
|
}
|
166
|
|
-
|
|
167
|
+
|
167
|
168
|
return NO;
|
168
|
169
|
}
|
169
|
170
|
|
|
@@ -198,17 +199,17 @@
|
198
|
199
|
animationControllerForOperation:(UINavigationControllerOperation)operation
|
199
|
200
|
fromViewController:(UIViewController*)fromVC
|
200
|
201
|
toViewController:(UIViewController*)toVC {
|
201
|
|
-{
|
202
|
|
- if (self.animator) {
|
203
|
|
- return self.animator;
|
204
|
|
- } else if (operation == UINavigationControllerOperationPush && self.options.animations.push.hasCustomAnimation) {
|
205
|
|
- return [[RNNPushAnimation alloc] initWithScreenTransition:self.options.animations.push];
|
206
|
|
- } else if (operation == UINavigationControllerOperationPop && self.options.animations.pop.hasCustomAnimation) {
|
207
|
|
- return [[RNNPushAnimation alloc] initWithScreenTransition:self.options.animations.pop];
|
208
|
|
- } else {
|
209
|
|
- return nil;
|
|
202
|
+ {
|
|
203
|
+ if (self.animator) {
|
|
204
|
+ return self.animator;
|
|
205
|
+ } else if (operation == UINavigationControllerOperationPush && self.options.animations.push.hasCustomAnimation) {
|
|
206
|
+ return [[RNNPushAnimation alloc] initWithScreenTransition:self.options.animations.push];
|
|
207
|
+ } else if (operation == UINavigationControllerOperationPop && self.options.animations.pop.hasCustomAnimation) {
|
|
208
|
+ return [[RNNPushAnimation alloc] initWithScreenTransition:self.options.animations.pop];
|
|
209
|
+ } else {
|
|
210
|
+ return nil;
|
|
211
|
+ }
|
210
|
212
|
}
|
211
|
|
-}
|
212
|
213
|
return nil;
|
213
|
214
|
}
|
214
|
215
|
|
|
@@ -242,9 +243,9 @@
|
242
|
243
|
if (self.previewController) {
|
243
|
244
|
RNNRootViewController * vc = (RNNRootViewController*) self.previewController;
|
244
|
245
|
[_eventEmitter sendOnNavigationEvent:@"previewContext" params:@{
|
245
|
|
- @"previewComponentId": vc.componentId,
|
246
|
|
- @"componentId": self.componentId
|
247
|
|
- }];
|
|
246
|
+ @"previewComponentId": vc.componentId,
|
|
247
|
+ @"componentId": self.componentId
|
|
248
|
+ }];
|
248
|
249
|
}
|
249
|
250
|
return self.previewController;
|
250
|
251
|
}
|
|
@@ -253,9 +254,9 @@
|
253
|
254
|
- (void)previewingContext:(id<UIViewControllerPreviewing>)previewingContext commitViewController:(UIViewController *)viewControllerToCommit {
|
254
|
255
|
RNNRootViewController * vc = (RNNRootViewController*) self.previewController;
|
255
|
256
|
NSDictionary * params = @{
|
256
|
|
- @"previewComponentId": vc.componentId,
|
257
|
|
- @"componentId": self.componentId
|
258
|
|
- };
|
|
257
|
+ @"previewComponentId": vc.componentId,
|
|
258
|
+ @"componentId": self.componentId
|
|
259
|
+ };
|
259
|
260
|
if (vc.options.preview.commit) {
|
260
|
261
|
[_eventEmitter sendOnNavigationEvent:@"previewCommit" params:params];
|
261
|
262
|
[self.navigationController pushViewController:vc animated:false];
|
|
@@ -273,7 +274,7 @@
|
273
|
274
|
NSString *actionTitle = action[@"title"];
|
274
|
275
|
UIPreviewActionStyle actionStyle = UIPreviewActionStyleDefault;
|
275
|
276
|
if ([action[@"style"] isEqualToString:@"selected"]) {
|
276
|
|
- actionStyle = UIPreviewActionStyleSelected;
|
|
277
|
+ actionStyle = UIPreviewActionStyleSelected;
|
277
|
278
|
} else if ([action[@"style"] isEqualToString:@"destructive"]) {
|
278
|
279
|
actionStyle = UIPreviewActionStyleDestructive;
|
279
|
280
|
}
|
|
@@ -288,16 +289,16 @@
|
288
|
289
|
for (NSDictionary *previewAction in self.options.preview.actions) {
|
289
|
290
|
UIPreviewAction *action = [self convertAction:previewAction];
|
290
|
291
|
NSDictionary *actionActions = previewAction[@"actions"];
|
291
|
|
- if (actionActions.count > 0) {
|
|
292
|
+ if (actionActions.count > 0) {
|
292
|
293
|
NSMutableArray *group = [[NSMutableArray alloc] init];
|
293
|
|
- for (NSDictionary *previewGroupAction in actionActions) {
|
294
|
|
- [group addObject:[self convertAction:previewGroupAction]];
|
295
|
|
- }
|
296
|
|
- UIPreviewActionGroup *actionGroup = [UIPreviewActionGroup actionGroupWithTitle:action.title style:UIPreviewActionStyleDefault actions:group];
|
297
|
|
- [actions addObject:actionGroup];
|
|
294
|
+ for (NSDictionary *previewGroupAction in actionActions) {
|
|
295
|
+ [group addObject:[self convertAction:previewGroupAction]];
|
|
296
|
+ }
|
|
297
|
+ UIPreviewActionGroup *actionGroup = [UIPreviewActionGroup actionGroupWithTitle:action.title style:UIPreviewActionStyleDefault actions:group];
|
|
298
|
+ [actions addObject:actionGroup];
|
298
|
299
|
} else {
|
299
|
|
- [actions addObject:action];
|
300
|
|
- }
|
|
300
|
+ [actions addObject:action];
|
|
301
|
+ }
|
301
|
302
|
}
|
302
|
303
|
return actions;
|
303
|
304
|
}
|