|
|
|
|
9
|
RNNReactComponentRegistry* _componentRegistry;
|
9
|
RNNReactComponentRegistry* _componentRegistry;
|
10
|
UIView* _customTopBar;
|
10
|
UIView* _customTopBar;
|
11
|
UIView* _customTopBarBackground;
|
11
|
UIView* _customTopBarBackground;
|
|
|
12
|
+ RNNReactView* _customTopBarBackgroundReactView;
|
12
|
}
|
13
|
}
|
13
|
|
14
|
|
14
|
@end
|
15
|
@end
|
|
|
|
|
46
|
[navigationController rnn_setNavigationBarFontFamily:[options.topBar.title.fontFamily getWithDefaultValue:nil] fontSize:[options.topBar.title.fontSize getWithDefaultValue:nil] color:[options.topBar.title.color getWithDefaultValue:nil]];
|
47
|
[navigationController rnn_setNavigationBarFontFamily:[options.topBar.title.fontFamily getWithDefaultValue:nil] fontSize:[options.topBar.title.fontSize getWithDefaultValue:nil] color:[options.topBar.title.color getWithDefaultValue:nil]];
|
47
|
[navigationController rnn_setBackButtonColor:[options.topBar.backButton.color getWithDefaultValue:nil]];
|
48
|
[navigationController rnn_setBackButtonColor:[options.topBar.backButton.color getWithDefaultValue:nil]];
|
48
|
[navigationController rnn_setBackButtonIcon:[options.topBar.backButton.icon getWithDefaultValue:nil] withColor:[options.topBar.backButton.color getWithDefaultValue:nil] title:[options.topBar.backButton.showTitle getWithDefaultValue:YES] ? [options.topBar.backButton.title getWithDefaultValue:nil] : @""];
|
49
|
[navigationController rnn_setBackButtonIcon:[options.topBar.backButton.icon getWithDefaultValue:nil] withColor:[options.topBar.backButton.color getWithDefaultValue:nil] title:[options.topBar.backButton.showTitle getWithDefaultValue:YES] ? [options.topBar.backButton.title getWithDefaultValue:nil] : @""];
|
|
|
50
|
+
|
|
|
51
|
+ if (options.topBar.background.component.name.hasValue) {
|
|
|
52
|
+ [self presentBackgroundComponent];
|
|
|
53
|
+ }
|
49
|
}
|
54
|
}
|
50
|
|
55
|
|
51
|
- (void)applyOptionsOnWillMoveToParentViewController:(RNNNavigationOptions *)options {
|
56
|
- (void)applyOptionsOnWillMoveToParentViewController:(RNNNavigationOptions *)options {
|
|
|
|
|
203
|
}
|
208
|
}
|
204
|
if (options.topBar.background.component.name.hasValue) {
|
209
|
if (options.topBar.background.component.name.hasValue) {
|
205
|
NSString* currentChildComponentId = [navigationController getCurrentChild].layoutInfo.componentId;
|
210
|
NSString* currentChildComponentId = [navigationController getCurrentChild].layoutInfo.componentId;
|
206
|
- RCTRootView *reactView = [_componentRegistry createComponentIfNotExists:options.topBar.background.component parentComponentId:currentChildComponentId reactViewReadyBlock:readyBlock];
|
|
|
|
|
211
|
+ RNNReactView *reactView = [_componentRegistry createComponentIfNotExists:options.topBar.background.component parentComponentId:currentChildComponentId reactViewReadyBlock:readyBlock];
|
|
|
212
|
+ _customTopBarBackgroundReactView = reactView;
|
207
|
|
213
|
|
208
|
- if (_customTopBarBackground) {
|
|
|
209
|
- [_customTopBarBackground removeFromSuperview];
|
|
|
210
|
- }
|
|
|
211
|
- RNNCustomTitleView* customTopBarBackground = [[RNNCustomTitleView alloc] initWithFrame:navigationController.navigationBar.bounds subView:reactView alignment:@"fill"];
|
|
|
212
|
- _customTopBarBackground = customTopBarBackground;
|
|
|
213
|
-
|
|
|
214
|
- [navigationController.navigationBar insertSubview:_customTopBarBackground atIndex:1];
|
|
|
215
|
} else {
|
214
|
} else {
|
216
|
[_customTopBarBackground removeFromSuperview];
|
215
|
[_customTopBarBackground removeFromSuperview];
|
217
|
_customTopBarBackground = nil;
|
216
|
_customTopBarBackground = nil;
|
|
|
|
|
221
|
}
|
220
|
}
|
222
|
}
|
221
|
}
|
223
|
|
222
|
|
|
|
223
|
+- (void)presentBackgroundComponent {
|
|
|
224
|
+ RNNNavigationController* navigationController = self.bindedViewController;
|
|
|
225
|
+ if (_customTopBarBackground) {
|
|
|
226
|
+ [_customTopBarBackground removeFromSuperview];
|
|
|
227
|
+ }
|
|
|
228
|
+ RNNCustomTitleView* customTopBarBackground = [[RNNCustomTitleView alloc] initWithFrame:navigationController.navigationBar.bounds subView:_customTopBarBackgroundReactView alignment:@"fill"];
|
|
|
229
|
+ _customTopBarBackground = customTopBarBackground;
|
|
|
230
|
+
|
|
|
231
|
+ [navigationController.navigationBar insertSubview:_customTopBarBackground atIndex:1];
|
|
|
232
|
+}
|
|
|
233
|
+
|
224
|
- (void)dealloc {
|
234
|
- (void)dealloc {
|
225
|
[_componentRegistry removeComponent:self.bindedComponentId];
|
235
|
[_componentRegistry removeComponent:self.bindedComponentId];
|
226
|
}
|
236
|
}
|