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

fix: md update - change styles of drawer item and remove uppercase from top tabs #11864

Merged
merged 3 commits into from
Mar 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions example/src/Screens/TabView/AutoWidthTabBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export const AutoWidthTabBar = () => {
indicatorStyle={styles.indicator}
style={styles.tabbar}
contentContainerStyle={styles.tabbarContentContainer}
labelStyle={styles.label}
tabStyle={styles.tabStyle}
gap={20}
direction={direction}
Expand Down Expand Up @@ -89,9 +88,6 @@ const styles = StyleSheet.create({
indicator: {
backgroundColor: '#ffeb3b',
},
label: {
fontWeight: '400',
},
tabStyle: {
width: 'auto',
},
Expand Down
4 changes: 0 additions & 4 deletions example/src/Screens/TabView/ScrollableTabBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export const ScrollableTabBar = () => {
style={styles.tabbar}
contentContainerStyle={styles.tabbarContentContainer}
tabStyle={styles.tab}
labelStyle={styles.label}
gap={20}
direction={direction}
/>
Expand Down Expand Up @@ -89,7 +88,4 @@ const styles = StyleSheet.create({
indicator: {
backgroundColor: '#ffeb3b',
},
label: {
fontWeight: '400',
},
});
27 changes: 15 additions & 12 deletions packages/drawer/src/views/DrawerItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export function DrawerItem(props: Props) {
...rest
} = props;

const { borderRadius = 4 } = StyleSheet.flatten(style || {});
const { borderRadius = 56 } = StyleSheet.flatten(style || {});
const color = focused ? activeTintColor : inactiveTintColor;
const backgroundColor = focused
? activeBackgroundColor
Expand All @@ -133,6 +133,7 @@ export function DrawerItem(props: Props) {
collapsable={false}
{...rest}
style={[styles.container, { borderRadius, backgroundColor }, style]}
onLayout={(e) => console.log(e.nativeEvent.layout)}
>
<PlatformPressable
testID={testID}
Expand All @@ -146,17 +147,12 @@ export function DrawerItem(props: Props) {
>
<View style={[styles.wrapper, { borderRadius }]}>
{iconNode}
<View
style={[
styles.label,
{ marginLeft: iconNode ? 32 : 0, marginVertical: 5 },
]}
>
<View style={[styles.label, { marginLeft: iconNode ? 16 : 0 }]}>
{typeof label === 'string' ? (
<Text
numberOfLines={1}
allowFontScaling={allowFontScaling}
style={[{ color }, fonts.medium, labelStyle]}
style={[styles.labelText, { color }, fonts.medium, labelStyle]}
>
{label}
</Text>
Expand All @@ -172,17 +168,24 @@ export function DrawerItem(props: Props) {

const styles = StyleSheet.create({
container: {
marginHorizontal: 10,
marginVertical: 4,
marginHorizontal: 12,
marginVertical: 2,
overflow: 'hidden',
},
wrapper: {
flexDirection: 'row',
alignItems: 'center',
padding: 8,
paddingVertical: 12,
paddingLeft: 16,
paddingRight: 24,
},
label: {
marginRight: 32,
marginRight: 12,
marginVertical: 4,
flex: 1,
},
labelText: {
lineHeight: 24,
textAlignVertical: 'center',
},
});
12 changes: 8 additions & 4 deletions packages/material-top-tabs/src/views/MaterialTopTabBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function MaterialTopTabBar({
descriptors,
...rest
}: MaterialTopTabBarProps) {
const { colors } = useTheme();
const { colors, fonts } = useTheme();
const { direction } = useLocale();

const focusedOptions = descriptors[state.routes[state.index].key].options;
Expand Down Expand Up @@ -107,7 +107,12 @@ export function MaterialTopTabBar({
if (typeof label === 'string') {
return (
<Text
style={[{ color }, styles.label, options.tabBarLabelStyle]}
style={[
{ color },
fonts.medium,
styles.label,
options.tabBarLabelStyle,
]}
allowFontScaling={options.tabBarAllowFontScaling}
>
{label}
Expand Down Expand Up @@ -150,8 +155,7 @@ const styles = StyleSheet.create({
},
label: {
textAlign: 'center',
textTransform: 'uppercase',
fontSize: 13,
fontSize: 14,
margin: 4,
backgroundColor: 'transparent',
},
Expand Down
3 changes: 2 additions & 1 deletion packages/react-native-tab-view/src/TabBarItemLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ export const TabBarItemLabel = React.memo(
const styles = StyleSheet.create({
label: {
margin: 4,
fontSize: 14,
fontWeight: '500',
backgroundColor: 'transparent',
textTransform: 'uppercase',
},
});
Loading