Skip to content

Commit f14bd64

Browse files
committed
fix: adjust default font size per platform
1 parent e9b06e7 commit f14bd64

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import UIKit
2+
3+
enum TabBarFontSize {
4+
/// Returns the default font size for tab bar item labels based on the current platform
5+
#if os(tvOS)
6+
static var defaultSize: CGFloat = 30.0
7+
#else
8+
static var defaultSize: CGFloat = {
9+
if UIDevice.current.userInterfaceIdiom == .pad {
10+
return 13.0
11+
}
12+
13+
return 10.0
14+
}()
15+
#endif
16+
}

packages/react-native-bottom-tabs/ios/TabViewImpl.swift

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,6 @@ private func createFontAttributes(
169169
return attributes
170170
}
171171

172-
#if os(tvOS)
173-
let tabBarDefaultFontSize: CGFloat = 30.0
174-
#else
175-
let tabBarDefaultFontSize: CGFloat = UIFont.smallSystemFontSize
176-
#endif
177-
178172
#if !os(macOS)
179173
private func configureTransparentAppearance(tabBar: UITabBar, props: TabViewProps) {
180174
tabBar.barTintColor = props.barTintColor
@@ -185,7 +179,7 @@ private func configureTransparentAppearance(tabBar: UITabBar, props: TabViewProp
185179

186180
guard let items = tabBar.items else { return }
187181

188-
let fontSize = props.fontSize != nil ? CGFloat(props.fontSize!) : tabBarDefaultFontSize
182+
let fontSize = props.fontSize != nil ? CGFloat(props.fontSize!) : TabBarFontSize.defaultSize
189183
let attributes = createFontAttributes(
190184
size: fontSize,
191185
family: props.fontFamily,

0 commit comments

Comments
 (0)