Skip to content

Commit a6ad5e5

Browse files
perf(mobile): make the thread status bar and scroll-to-end snap
Snap the scroll-to-end chevron in immediately, skip liquid-glass material animation, fire status/queue/agent presses on press-in, and shorten the label and coverage timings so the bar feels ready instead of fading in after the fact. Co-authored-by: Cursor <[email protected]>
1 parent c331752 commit a6ad5e5

2 files changed

Lines changed: 25 additions & 13 deletions

File tree

‎apps/mobile/src/features/threads/ThreadDetailScreen.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1177,7 +1177,7 @@ function ThreadDetailBody(
11771177
() =>
11781178
withTiming(
11791179
floatingCoverageTarget,
1180-
{ duration: 180, reduceMotion: ReduceMotion.System },
1180+
{ duration: 120, reduceMotion: ReduceMotion.System },
11811181
(finished) => {
11821182
if (finished) runOnJS(repinAfterCoverageSettles)(floatingCoverageTarget);
11831183
},

‎apps/mobile/src/features/threads/floating-working-control.tsx‎

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,23 @@ const CONTROL_HEIGHT = 38.5;
3737
const CONTROL_GAP = 8;
3838
const COMPOSER_CAPSULE_INSET = 6;
3939
const GLASS_MERGE_SPACING = 12;
40-
const CONTROL_ENTERING = FadeIn.duration(180).reduceMotion(ReduceMotion.System);
41-
const CONTROL_EXITING = FadeOut.duration(120).reduceMotion(ReduceMotion.System);
40+
const CONTROL_ENTERING = FadeIn.duration(120).reduceMotion(ReduceMotion.System);
41+
const CONTROL_EXITING = FadeOut.duration(90).reduceMotion(ReduceMotion.System);
4242
const CONTROL_TIMING = {
43-
duration: 240,
43+
duration: 120,
4444
easing: Easing.out(Easing.cubic),
4545
reduceMotion: ReduceMotion.System,
4646
} as const;
47+
const CONTROL_HIDE_TIMING = {
48+
duration: 100,
49+
easing: Easing.in(Easing.cubic),
50+
reduceMotion: ReduceMotion.System,
51+
} as const;
4752
const CONTROL_ROW_GAP = 14;
4853
const CONTROL_SEPARATION = (CONTROL_ROW_GAP + CONTROL_HEIGHT) / 2;
49-
const LABEL_ENTERING = FadeIn.duration(160).delay(80).reduceMotion(ReduceMotion.System);
50-
const LABEL_EXITING = FadeOut.duration(100).reduceMotion(ReduceMotion.System);
54+
// No enter delay — the status pill should read as already there when chrome settles.
55+
const LABEL_ENTERING = FadeIn.duration(100).reduceMotion(ReduceMotion.System);
56+
const LABEL_EXITING = FadeOut.duration(80).reduceMotion(ReduceMotion.System);
5157

5258
// Expo reapplies glass after layout or reattachment, restoring material UIKit can lose behind visible labels.
5359
const UniwindGlassView = withUniwind(GlassView, {
@@ -120,7 +126,9 @@ export function FloatingWorkingControl(props: {
120126

121127
// oxlint-disable-next-line t3code/no-unreasoned-state-sync -- animates the Reanimated separation value when scroll-to-end visibility changes
122128
useEffect(() => {
123-
separationProgress.set(withTiming(props.showScrollToEnd ? 1 : 0, CONTROL_TIMING));
129+
// Snap in so the chevron is tappable immediately; only animate the hide.
130+
if (props.showScrollToEnd) separationProgress.set(1);
131+
else separationProgress.set(withTiming(0, CONTROL_HIDE_TIMING));
124132
}, [props.showScrollToEnd, separationProgress]);
125133

126134
const lift = props.lift;
@@ -218,7 +226,7 @@ export function FloatingWorkingControl(props: {
218226
accessibilityRole="button"
219227
accessibilityLabel={extensionStatus.label}
220228
accessibilityHint="Shows the full Pi status"
221-
onPress={extensionStatus.onPress}
229+
onPressIn={extensionStatus.onPress}
222230
onLayout={(event) => setExtensionWidth(settleWidth(event.nativeEvent.layout.width))}
223231
style={{ maxWidth: availableLabelWidth * 0.5 }}
224232
className="h-11 flex-row items-center px-3 active:opacity-70"
@@ -240,7 +248,7 @@ export function FloatingWorkingControl(props: {
240248
accessibilityLabel={action.accessibilityLabel}
241249
accessibilityState={{ disabled: action.disabled }}
242250
disabled={action.disabled}
243-
onPress={action.onPress}
251+
onPressIn={action.disabled ? undefined : action.onPress}
244252
className={`h-11 items-center justify-center px-3 active:opacity-70 ${action.disabled ? "opacity-50" : ""}`}
245253
>
246254
<Text className="font-t3-medium text-xs text-foreground" numberOfLines={1}>
@@ -268,7 +276,7 @@ export function FloatingWorkingControl(props: {
268276
accessibilityRole="button"
269277
accessibilityLabel={`Open agents, ${agents.accessibilityLabel}`}
270278
accessibilityHint="Opens this turn's subagents"
271-
onPress={props.onOpenAgents}
279+
onPressIn={props.onOpenAgents}
272280
onLayout={(event) => setAgentsWidth(settleWidth(event.nativeEvent.layout.width))}
273281
className="h-11 flex-row items-center gap-1.5 px-3 active:opacity-70"
274282
>
@@ -284,7 +292,7 @@ export function FloatingWorkingControl(props: {
284292
accessibilityRole="button"
285293
accessibilityLabel={`Open queue, ${props.queuedCount} messages`}
286294
accessibilityHint="Opens queued messages to send now, edit, or remove"
287-
onPress={props.onOpenQueue}
295+
onPressIn={props.onOpenQueue}
288296
onLayout={(event) => setQueueWidth(settleWidth(event.nativeEvent.layout.width))}
289297
style={{ maxWidth: Math.min(overlayWidth, windowWidth) * 0.45 }}
290298
className="h-11 flex-row items-center gap-2 px-3 active:opacity-70"
@@ -329,7 +337,11 @@ export function FloatingWorkingControl(props: {
329337

330338
<AnimatedGlassView
331339
colorScheme={props.colorScheme}
332-
glassEffectStyle={{ style: props.showScrollToEnd ? "regular" : "none", animate: true }}
340+
// Avoid animating liquid-glass material on/off — that reapplication lags taps.
341+
glassEffectStyle={{
342+
style: props.showScrollToEnd ? "regular" : "none",
343+
animate: false,
344+
}}
333345
isInteractive
334346
pointerEvents={props.showScrollToEnd ? "auto" : "none"}
335347
accessibilityElementsHidden={!props.showScrollToEnd}
@@ -624,7 +636,7 @@ function StatusLabelRow(props: {
624636
accessibilityLabel={props.accessibilityLabel}
625637
accessibilityRole={props.accessibilityRole}
626638
className={`${rowClassName} active:opacity-70`}
627-
onPress={props.onPress}
639+
onPressIn={props.onPress}
628640
>
629641
{props.children}
630642
</Pressable>

0 commit comments

Comments
 (0)