From e3c9e928014a6468c31420c2544c3e62898e2659 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oskar=20Kwas=CC=81niewski?= Date: Fri, 1 Nov 2024 16:23:42 +0100 Subject: [PATCH] fix: transparent scroll edge apperance --- ios/TabViewImpl.swift | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ios/TabViewImpl.swift b/ios/TabViewImpl.swift index 7e54f7d..3f54104 100644 --- a/ios/TabViewImpl.swift +++ b/ios/TabViewImpl.swift @@ -128,16 +128,21 @@ struct TabViewImpl: View { } } +@available(iOS 15.0, *) private func configureAppearance(for appearanceType: String, appearance: UITabBarAppearance) -> UITabBarAppearance { + if (appearanceType == "transparent") { + return appearance + } + switch appearanceType { case "opaque": appearance.configureWithOpaqueBackground() - case "transparent": - appearance.configureWithTransparentBackground() default: appearance.configureWithDefaultBackground() } + UITabBar.appearance().scrollEdgeAppearance = appearance + return appearance } @@ -159,14 +164,14 @@ private func configureAppearance(inactiveTint inactiveTintColor: UIColor?, appea private func updateTabBarAppearance(props: TabViewProps) { var appearance = UITabBarAppearance() - appearance = configureAppearance(for: props.scrollEdgeAppearance ?? "", appearance: appearance) appearance = configureAppearance( inactiveTint: props.inactiveTintColor, appearance: appearance ) + if #available(iOS 15.0, *) { - UITabBar.appearance().scrollEdgeAppearance = appearance + appearance = configureAppearance(for: props.scrollEdgeAppearance ?? "", appearance: appearance) if props.translucent == false { appearance.configureWithOpaqueBackground()