Skip to content

Commit 7eee6fb

Browse files
committed
Cleanup in RNSScreenStackHeaderConfig
1 parent 8360b4f commit 7eee6fb

File tree

1 file changed

+22
-42
lines changed

1 file changed

+22
-42
lines changed

ios/RNSScreenStackHeaderConfig.mm

Lines changed: 22 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -594,55 +594,35 @@ + (void)updateViewController:(UIViewController *)vc
594594
}
595595
#endif
596596

597-
// TODO: This needs to be removed after min. tvOS deployment target bump
598-
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \
599-
__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0
600-
if (@available(iOS 13.0, tvOS 13.0, *)) {
601-
UINavigationBarAppearance *appearance = [self buildAppearance:vc withConfig:config];
602-
navitem.standardAppearance = appearance;
603-
navitem.compactAppearance = appearance;
597+
UINavigationBarAppearance *appearance = [self buildAppearance:vc withConfig:config];
598+
navitem.standardAppearance = appearance;
599+
navitem.compactAppearance = appearance;
604600

605601
// appearance does not apply to the tvOS so we need to use lagacy customization
606602
#if TARGET_OS_TV
607-
navctr.navigationBar.titleTextAttributes = appearance.titleTextAttributes;
608-
navctr.navigationBar.backgroundColor = appearance.backgroundColor;
603+
navctr.navigationBar.titleTextAttributes = appearance.titleTextAttributes;
604+
navctr.navigationBar.backgroundColor = appearance.backgroundColor;
609605
#endif
610606

611-
UINavigationBarAppearance *scrollEdgeAppearance =
612-
[[UINavigationBarAppearance alloc] initWithBarAppearance:appearance];
613-
if (config.largeTitleBackgroundColor != nil) {
614-
// Add support for using a fully transparent bar when the backgroundColor is set to transparent.
615-
if (CGColorGetAlpha(config.largeTitleBackgroundColor.CGColor) == 0.) {
616-
// This will also remove the background blur effect in the large title which is otherwise inherited from the
617-
// standard appearance.
618-
[scrollEdgeAppearance configureWithTransparentBackground];
619-
// This must be set to nil otherwise a default view will be added to the navigation bar background with an
620-
// opaque background.
621-
scrollEdgeAppearance.backgroundColor = nil;
622-
} else {
623-
scrollEdgeAppearance.backgroundColor = config.largeTitleBackgroundColor;
624-
}
625-
}
626-
if (config.largeTitleHideShadow) {
627-
scrollEdgeAppearance.shadowColor = nil;
628-
}
629-
navitem.scrollEdgeAppearance = scrollEdgeAppearance;
630-
} else
631-
#endif // Check for iOS / tvOS 13
632-
{
633-
#if !TARGET_OS_TV
634-
// updating backIndicatotImage does not work when called during transition. On iOS pre 13 we need
635-
// to update it before the navigation starts.
636-
UIImage *backButtonImage = [config loadBackButtonImageInViewController:vc];
637-
if (backButtonImage) {
638-
navctr.navigationBar.backIndicatorImage = backButtonImage;
639-
navctr.navigationBar.backIndicatorTransitionMaskImage = backButtonImage;
640-
} else if (navctr.navigationBar.backIndicatorImage) {
641-
navctr.navigationBar.backIndicatorImage = nil;
642-
navctr.navigationBar.backIndicatorTransitionMaskImage = nil;
607+
UINavigationBarAppearance *scrollEdgeAppearance =
608+
[[UINavigationBarAppearance alloc] initWithBarAppearance:appearance];
609+
if (config.largeTitleBackgroundColor != nil) {
610+
// Add support for using a fully transparent bar when the backgroundColor is set to transparent.
611+
if (CGColorGetAlpha(config.largeTitleBackgroundColor.CGColor) == 0.) {
612+
// This will also remove the background blur effect in the large title which is otherwise inherited from the
613+
// standard appearance.
614+
[scrollEdgeAppearance configureWithTransparentBackground];
615+
// This must be set to nil otherwise a default view will be added to the navigation bar background with an
616+
// opaque background.
617+
scrollEdgeAppearance.backgroundColor = nil;
618+
} else {
619+
scrollEdgeAppearance.backgroundColor = config.largeTitleBackgroundColor;
643620
}
644-
#endif
645621
}
622+
if (config.largeTitleHideShadow) {
623+
scrollEdgeAppearance.shadowColor = nil;
624+
}
625+
navitem.scrollEdgeAppearance = scrollEdgeAppearance;
646626
#if !TARGET_OS_TV
647627
navitem.hidesBackButton = config.hideBackButton;
648628
#endif

0 commit comments

Comments
 (0)