Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugs + (partial) Fixes: Non-responsiveness of "tabBarLabelStyle" and "tabBarLabel" in MaterialTopTabBar #11968

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 9 additions & 6 deletions packages/material-top-tabs/src/views/MaterialTopTabBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ import type { MaterialTopTabBarProps } from '../types';
type MaterialLabelType = {
color: string;
label?: string;
labelStyle?: StyleProp<ViewStyle>;
style?: StyleProp<ViewStyle>;
allowScaling?: boolean;
};

const MaterialLabel = ({
color,
label,
labelStyle,
style,
allowScaling,
}: MaterialLabelType) => {
return (
<Text
style={[{ color }, styles.label, labelStyle]}
style={[{ color }, styles.label, style]}
allowFontScaling={allowScaling}
>
{label}
Expand Down Expand Up @@ -76,9 +76,12 @@ export function MaterialTopTabBar({
labelText:
options.tabBarShowLabel === false
? undefined
: options.title !== undefined
? options.title
: route.name,
: options.tabBarLabel !== undefined &&
typeof options.tabBarLabel === 'string'
? options.tabBarLabel
: options.title !== undefined
? options.title
: route.name,
},
];
})
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-tab-view/src/TabBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,6 @@ export function TabBar<T extends Route>({
: undefined;

const props = {
...rest,
key: route.key,
position,
route,
Expand All @@ -545,6 +544,7 @@ export function TabBar<T extends Route>({
style: tabStyle,
defaultTabWidth,
android_ripple,
...rest,
} satisfies TabBarItemProps<T> & { key: string };

return (
Expand Down