Skip to content

Commit 4e3a7c1

Browse files
committed
fix: change api
1 parent 2167733 commit 4e3a7c1

File tree

3 files changed

+32
-14
lines changed

3 files changed

+32
-14
lines changed

docs/docs/docs/guides/usage-with-react-navigation.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,16 @@ Tab views using the sidebar adaptable style have an appearance
149149

150150
Whether to enable haptic feedback on tab press. Defaults to true.
151151

152+
#### `tabLabelStyle`
153+
154+
Object containing styles for the tab label.
155+
156+
Supported properties:
157+
- `fontFamily`
158+
- `fontSize`
159+
- `fontWeight`
160+
161+
152162
### Options
153163

154164
The following options can be used to configure the screens in the navigator. These can be specified under `screenOptions` prop of `Tab.navigator` or `options` prop of `Tab.Screen`.

example/src/Examples/NativeBottomTabs.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ function NativeBottomTabs() {
1818
tabBarActiveTintColor="#F7DBA7"
1919
barTintColor="#1E2D2F"
2020
rippleColor="#F7DBA7"
21-
fontFamily="Avenir"
22-
fontSize={15}
21+
tabLabelStyle={{
22+
fontFamily: 'Avenir',
23+
fontSize: 15,
24+
}}
2325
activeIndicatorColor="#041F1E"
2426
screenListeners={{
2527
tabLongPress: (data) => {

src/TabView.tsx

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -123,18 +123,22 @@ interface Props<Route extends BaseRoute> {
123123
* Color of tab indicator. (Android only)
124124
*/
125125
activeIndicatorColor?: ColorValue;
126-
/**
127-
* Font family for the tab labels.
128-
*/
129-
fontFamily?: string;
130-
/**
131-
* Font weight for the tab labels.
132-
*/
133-
fontWeight?: string;
134-
/**
135-
* Font size for the tab labels.
136-
*/
137-
fontSize?: number;
126+
tabLabelStyle?: {
127+
/**
128+
* Font family for the tab labels.
129+
*/
130+
fontFamily?: string;
131+
132+
/**
133+
* Font weight for the tab labels.
134+
*/
135+
fontWeight?: string;
136+
137+
/**
138+
* Font size for the tab labels.
139+
*/
140+
fontSize?: number;
141+
};
138142
}
139143

140144
const ANDROID_MAX_TABS = 6;
@@ -160,6 +164,7 @@ const TabView = <Route extends BaseRoute>({
160164
getHidden = ({ route }: { route: Route }) => route.hidden,
161165
getActiveTintColor = ({ route }: { route: Route }) => route.activeTintColor,
162166
hapticFeedbackEnabled = true,
167+
tabLabelStyle,
163168
...props
164169
}: Props<Route>) => {
165170
// @ts-ignore
@@ -250,6 +255,7 @@ const TabView = <Route extends BaseRoute>({
250255
return (
251256
<TabViewAdapter
252257
{...props}
258+
{...tabLabelStyle}
253259
style={styles.fullWidth}
254260
items={items}
255261
icons={resolvedIconAssets}

0 commit comments

Comments
 (0)