From 9c48a78bc2c01e68e3d9d184f5df637f6b331c53 Mon Sep 17 00:00:00 2001 From: Mohammad Ali Jafarian Date: Mon, 4 Feb 2019 12:43:11 +0330 Subject: [PATCH] [V2][IOS] fixes noBorder issue with largeTitle (#4310) * fixes noBorder issue with largeTitle * fixes issue that change navigationbar title color to default --- lib/ios/RNNNavigationControllerPresenter.m | 6 +++++- lib/ios/UINavigationController+RNNOptions.m | 9 +++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/ios/RNNNavigationControllerPresenter.m b/lib/ios/RNNNavigationControllerPresenter.m index c2bbe3927f3..0961833feab 100644 --- a/lib/ios/RNNNavigationControllerPresenter.m +++ b/lib/ios/RNNNavigationControllerPresenter.m @@ -104,7 +104,11 @@ - (void)mergeOptions:(RNNNavigationOptions *)newOptions currentOptions:(RNNNavig [navigationController rnn_setBackButtonColor:newOptions.topBar.backButton.color.get]; } - [navigationController rnn_setNavigationBarLargeTitleFontFamily:[newOptions.topBar.largeTitle.fontFamily getWithDefaultValue:nil] fontSize:[newOptions.topBar.largeTitle.fontSize getWithDefaultValue:nil] color:[newOptions.topBar.largeTitle.color getWithDefaultValue:nil]]; + + RNNLargeTitleOptions *largteTitleOptions = newOptions.topBar.largeTitle; + if (largteTitleOptions.color.hasValue || largteTitleOptions.fontSize.hasValue || largteTitleOptions.fontFamily.hasValue) { + [navigationController rnn_setNavigationBarLargeTitleFontFamily:[newOptions.topBar.largeTitle.fontFamily getWithDefaultValue:nil] fontSize:[newOptions.topBar.largeTitle.fontSize getWithDefaultValue:nil] color:[newOptions.topBar.largeTitle.color getWithDefaultValue:nil]]; + } [navigationController rnn_setNavigationBarFontFamily:[newOptions.topBar.title.fontFamily getWithDefaultValue:nil] fontSize:[newOptions.topBar.title.fontSize getWithDefaultValue:nil] color:[newOptions.topBar.title.color getWithDefaultValue:nil]]; diff --git a/lib/ios/UINavigationController+RNNOptions.m b/lib/ios/UINavigationController+RNNOptions.m index c2f983c75b2..5a6c2e9c4a1 100644 --- a/lib/ios/UINavigationController+RNNOptions.m +++ b/lib/ios/UINavigationController+RNNOptions.m @@ -36,12 +36,9 @@ - (void)rnn_hideBarsOnScroll:(BOOL)hideOnScroll { - (void)rnn_setNavigationBarNoBorder:(BOOL)noBorder { if (noBorder) { - self.navigationBar - .shadowImage = [[UIImage alloc] init]; - [self.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault]; + [self.navigationBar setShadowImage:[[UIImage alloc] init]]; } else { - self.navigationBar - .shadowImage = nil; + [self.navigationBar setShadowImage:nil]; } } @@ -114,7 +111,7 @@ - (void)rnn_setBackButtonIcon:(UIImage *)icon withColor:(UIColor *)color title:( backItem.title = title ? title : lastViewControllerInStack.navigationItem.title; backItem.tintColor = color; - + lastViewControllerInStack.navigationItem.backBarButtonItem = backItem; }