Skip to content

Commit f489f69

Browse files
committed
fix(mobile): keep section tabs reachable and easier to tap
1 parent 41dc39f commit f489f69

2 files changed

Lines changed: 55 additions & 49 deletions

File tree

Lines changed: 54 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { GlassView } from "expo-glass-effect";
22
import { useState } from "react";
3-
import { Pressable, View } from "react-native";
3+
import { Pressable, ScrollView, View } from "react-native";
44
import Animated, { useAnimatedStyle, useReducedMotion, withTiming } from "react-native-reanimated";
55
import { withUniwind } from "uniwind";
66

@@ -34,54 +34,60 @@ export function Tabs<Value extends string>(props: TabsProps<Value>) {
3434
}));
3535

3636
return (
37-
<View accessibilityRole="tablist" className={cn("flex-row", props.className)}>
38-
{frame ? (
39-
<Animated.View
40-
pointerEvents="none"
41-
className="absolute bottom-0 left-0 top-0 rounded-full border border-border-subtle"
42-
style={indicatorStyle}
43-
>
44-
{NATIVE_LIQUID_GLASS_SUPPORTED ? (
45-
<TabGlass
46-
className="flex-1 rounded-full"
47-
colorScheme={themeAppearance === "dark" ? "dark" : "light"}
48-
/>
49-
) : (
50-
<View className="flex-1 rounded-full bg-grouped-card" />
51-
)}
52-
</Animated.View>
53-
) : null}
54-
{props.options.map((option) => {
55-
const selected = option.value === props.selected;
56-
return (
57-
<Pressable
58-
key={option.value}
59-
accessibilityRole="tab"
60-
accessibilityLabel={option.label}
61-
accessibilityState={{ selected }}
62-
onPress={() => props.onSelect(option.value)}
63-
onLayout={({ nativeEvent: { layout } }) =>
64-
setFrames((current) =>
65-
current[option.value]?.x === layout.x &&
66-
current[option.value]?.width === layout.width
67-
? current
68-
: { ...current, [option.value]: { x: layout.x, width: layout.width } },
69-
)
70-
}
71-
className="min-h-8 flex-row items-center gap-1.5 rounded-full px-3.5 active:opacity-70"
37+
<ScrollView
38+
horizontal
39+
showsHorizontalScrollIndicator={false}
40+
className={cn("grow-0", props.className)}
41+
>
42+
<View accessibilityRole="tablist" className="flex-row">
43+
{frame ? (
44+
<Animated.View
45+
pointerEvents="none"
46+
className="absolute bottom-0 left-0 top-0 rounded-full border border-border-subtle"
47+
style={indicatorStyle}
7248
>
73-
<AppText
74-
textRole="footnote"
75-
className={cn(
76-
"font-t3-semibold",
77-
selected ? "text-foreground" : "text-foreground-muted",
78-
)}
49+
{NATIVE_LIQUID_GLASS_SUPPORTED ? (
50+
<TabGlass
51+
className="flex-1 rounded-full"
52+
colorScheme={themeAppearance === "dark" ? "dark" : "light"}
53+
/>
54+
) : (
55+
<View className="flex-1 rounded-full bg-grouped-card" />
56+
)}
57+
</Animated.View>
58+
) : null}
59+
{props.options.map((option) => {
60+
const selected = option.value === props.selected;
61+
return (
62+
<Pressable
63+
key={option.value}
64+
accessibilityRole="tab"
65+
accessibilityLabel={option.label}
66+
accessibilityState={{ selected }}
67+
onPress={() => props.onSelect(option.value)}
68+
onLayout={({ nativeEvent: { layout } }) =>
69+
setFrames((current) =>
70+
current[option.value]?.x === layout.x &&
71+
current[option.value]?.width === layout.width
72+
? current
73+
: { ...current, [option.value]: { x: layout.x, width: layout.width } },
74+
)
75+
}
76+
className="min-h-11 shrink-0 flex-row items-center gap-1.5 rounded-full px-3.5 active:opacity-70"
7977
>
80-
{option.label}
81-
</AppText>
82-
</Pressable>
83-
);
84-
})}
85-
</View>
78+
<AppText
79+
textRole="footnote"
80+
className={cn(
81+
"font-t3-semibold",
82+
selected ? "text-foreground" : "text-foreground-muted",
83+
)}
84+
>
85+
{option.label}
86+
</AppText>
87+
</Pressable>
88+
);
89+
})}
90+
</View>
91+
</ScrollView>
8692
);
8793
}

‎apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@ export function PullRequestRouteScreen({ route }: StaticScreenProps<PullRequestP
887887
className="-mx-3.5"
888888
/>
889889
) : (
890-
<View style={{ height: 32 }} />
890+
<View style={{ height: 44 }} />
891891
)}
892892
</View>
893893
) : null}

0 commit comments

Comments
 (0)