diff --git a/config/scripts/build-mobile-web-app-bundle.mjs b/config/scripts/build-mobile-web-app-bundle.mjs
index d7120f50096..3c18940d007 100644
--- a/config/scripts/build-mobile-web-app-bundle.mjs
+++ b/config/scripts/build-mobile-web-app-bundle.mjs
@@ -102,8 +102,10 @@ export const MOBILE_WEB_APP_ROOT_RESET =
// Use zero-specificity native parity: remove text-field focus rings only; keyboard buttons keep browser rings.
// Disable body text selection/callout to prevent WebKit/Android long-press interference, including portaled modals; fields opt back in.
+// Stop the WebView rubber-banding the whole page (headers included) when an inner list hits its end; inner scrollers keep their bounce.
export const MOBILE_WEB_APP_NATIVE_PARITY_STYLE =
''
diff --git a/config/scripts/mobile-web-app/mobile-web-app-source-control-text-inputs.test.mjs b/config/scripts/mobile-web-app/mobile-web-app-source-control-text-inputs.test.mjs
index 235137c9fbf..7bd396e2118 100644
--- a/config/scripts/mobile-web-app/mobile-web-app-source-control-text-inputs.test.mjs
+++ b/config/scripts/mobile-web-app/mobile-web-app-source-control-text-inputs.test.mjs
@@ -18,6 +18,7 @@ const describeClosure = mobileWebAppDependenciesPresent() ? describe : describe.
const HUB = 'app/h/[hostId]/source-control/[worktreeId].tsx'
const REVIEW = 'app/h/[hostId]/review/[worktreeId].tsx'
+const FILE_PREVIEW = 'app/h/[hostId]/files/preview/[worktreeId].tsx'
// The pages' inputs take their size from the chat composer's shared styles.
const COMPOSER_INPUT_STYLES = 'src/components/composer-input/composer-input-styles.ts'
@@ -424,14 +425,17 @@ describe('a style module with a platform sibling', () => {
})
describeClosure(
- 'the text inputs the source-control and review pages reach',
+ 'the text inputs the source-control, review and file preview pages reach',
() => {
- it.each([HUB, REVIEW])('takes every input size through the seam: %s', async (route) => {
- const closure = await mobileWebAppRouteClosure(route)
- expect(textInputFontSizeOffenders(mobileDir, closure)).toEqual([])
- })
+ it.each([HUB, REVIEW, FILE_PREVIEW])(
+ 'takes every input size through the seam: %s',
+ async (route) => {
+ const closure = await mobileWebAppRouteClosure(route)
+ expect(textInputFontSizeOffenders(mobileDir, closure)).toEqual([])
+ }
+ )
- it.each([HUB, REVIEW])(
+ it.each([HUB, REVIEW, FILE_PREVIEW])(
'reads every input it found, so the list above is complete: %s',
async (route) => {
const closure = await mobileWebAppRouteClosure(route)
diff --git a/config/scripts/mobile-web-app/mobile-web-app-stack-transition-render.test.mjs b/config/scripts/mobile-web-app/mobile-web-app-stack-transition-render.test.mjs
index c4bf13c4c72..3c49f916444 100644
--- a/config/scripts/mobile-web-app/mobile-web-app-stack-transition-render.test.mjs
+++ b/config/scripts/mobile-web-app/mobile-web-app-stack-transition-render.test.mjs
@@ -353,7 +353,7 @@ describeRender('the host stack transition on the page', () => {
await page.close()
}, 120_000)
- it('swaps instantly in the tablet split view and under reduced motion', async () => {
+ it('swaps without sliding in the tablet split view and under reduced motion', async () => {
for (const options of [{ animation: 'none' }, { reducedMotion: 'reduce' }]) {
const { errors, page } = await open(options)
const pushed = await sampleFrames(page, 'push')
diff --git a/config/scripts/mobile-web-app/mobile-web-app-working-spinner-render.test.mjs b/config/scripts/mobile-web-app/mobile-web-app-working-spinner-render.test.mjs
index c72cd01199a..886cd521efd 100644
--- a/config/scripts/mobile-web-app/mobile-web-app-working-spinner-render.test.mjs
+++ b/config/scripts/mobile-web-app/mobile-web-app-working-spinner-render.test.mjs
@@ -111,13 +111,15 @@ async function openProbe() {
return { errors, page }
}
+// The rings turn with Web Animations, which never write inline style, so read the computed rotation.
const readRotations = (page) =>
page.evaluate(() =>
- ['working-spinner', 'working-dot'].map(
- (id) =>
- [...document.querySelectorAll(`#${id} *`)].find((node) => node.style.transform)?.style
- .transform ?? null
- )
+ ['working-spinner', 'working-dot'].map((id) => {
+ const ring = [...document.querySelectorAll(`#${id} *`)].find(
+ (node) => node.getAnimations().length > 0
+ )
+ return ring ? getComputedStyle(ring).transform : null
+ })
)
describeRender('working rings on the page', () => {
diff --git a/mobile/app/connection-log.tsx b/mobile/app/connection-log.tsx
index 970f0bc3835..b66c2fad682 100644
--- a/mobile/app/connection-log.tsx
+++ b/mobile/app/connection-log.tsx
@@ -22,6 +22,7 @@ import { connectionDiagnosticsScreenStyles as styles } from '../src/diagnostics/
import { useMobileColorScheme } from '../src/theme/use-mobile-color-scheme'
import { NATIVE_APP_LOG_ID } from '../src/diagnostics/native-render-log'
import type { ConnectionLogEntry, HostProfile } from '../src/transport/types'
+import { pressedStyle } from '../src/theme/mobile-theme'
// Keep empty snapshot identity stable or useSyncExternalStore rerenders forever.
const EMPTY_ENTRIES: readonly ConnectionLogEntry[] = []
@@ -111,7 +112,11 @@ export default function NativeConnectionLogRoute() {
{hosts.map((host) => (
[
+ styles.hostChip,
+ host.id === selectedId && styles.hostChipActive,
+ pressed && pressedStyle
+ ]}
onPress={() =>
setManualSelection({ hostId: host.id, requestedHostId: params.hostId, routeKey })
}
diff --git a/mobile/app/h/[hostId]/edit.tsx b/mobile/app/h/[hostId]/edit.tsx
index 6d8b7311d16..43d5baa2025 100644
--- a/mobile/app/h/[hostId]/edit.tsx
+++ b/mobile/app/h/[hostId]/edit.tsx
@@ -11,7 +11,7 @@ import {
import { useSafeAreaInsets } from 'react-native-safe-area-context'
import { useLocalSearchParams, useRouter } from 'expo-router'
import { ChevronLeft } from 'lucide-react-native'
-import { colors, radii, spacing, typography } from '../../../src/theme/mobile-theme'
+import { colors, radii, spacing, typography, pressedStyle } from '../../../src/theme/mobile-theme'
import { themedStyleSheet } from '../../../src/theme/themed-styles'
import { useMobileColorScheme } from '../../../src/theme/use-mobile-color-scheme'
import { loadHosts, updateHostNameAndEndpoint } from '../../../src/transport/host-store'
@@ -173,7 +173,7 @@ export default function EditHostScreen() {
[styles.backButton, pressed && pressedStyle]}
onPress={leave}
accessibilityRole="button"
accessibilityLabel={t('common.back', 'Back')}
@@ -202,7 +202,10 @@ export default function EditHostScreen() {
{loadError ? (
{loadError}
-
+ [styles.secondaryButton, pressed && pressedStyle]}
+ onPress={leave}
+ >
{t('host.edit.goBack', 'Go back')}
diff --git a/mobile/app/mobile-onboarding.tsx b/mobile/app/mobile-onboarding.tsx
index 3e023984dc0..d75df8e51ce 100644
--- a/mobile/app/mobile-onboarding.tsx
+++ b/mobile/app/mobile-onboarding.tsx
@@ -1,5 +1,5 @@
import { useCallback, useMemo, useRef, useState } from 'react'
-import { Animated, BackHandler, Text, View, type LayoutChangeEvent } from 'react-native'
+import { Animated, BackHandler, Easing, Text, View, type LayoutChangeEvent } from 'react-native'
import { useFocusEffect, useLocalSearchParams, useRouter } from 'expo-router'
import { SafeAreaView } from 'react-native-safe-area-context'
import { OrcaLogo } from '../src/components/OrcaLogo'
@@ -10,6 +10,7 @@ import {
type NotificationOnboardingChoice
} from '../src/onboarding/MobileOnboardingPage'
import { parseMobileOnboardingSteps } from '../src/onboarding/mobile-onboarding-plan'
+import { PUSH_CURVE, PUSH_SLIDE_MS } from '../src/navigation/push-motion'
import { useReducedMotionEnabled } from '../src/platform/use-reduced-motion'
import { useMobileColorScheme } from '../src/theme/use-mobile-color-scheme'
import { mobileOnboardingStyles as styles } from '../src/onboarding/mobile-onboarding-styles'
@@ -20,8 +21,6 @@ import {
import { setRemotePushEnabled } from '../src/notifications/push-registration'
import { useMobileTranslation } from '../src/i18n/use-mobile-translation'
-const SLIDE_DURATION_MS = 280
-
export default function MobileOnboardingScreen() {
const params = useLocalSearchParams<{
hostId?: string | string[]
@@ -82,7 +81,8 @@ function MobileOnboardingFlow({
Animated.timing(slideProgress, {
toValue: nextIndex,
// Preserve carousel continuity while honoring reduced motion.
- duration: reducedMotionEnabled === true ? 0 : SLIDE_DURATION_MS,
+ duration: reducedMotionEnabled === true ? 0 : PUSH_SLIDE_MS,
+ easing: Easing.bezier(...PUSH_CURVE),
useNativeDriver: true
}).start(() => {
// Cancelled cosmetic animation must not block the next choice after previous choice persisted.
diff --git a/mobile/app/pair-confirm.tsx b/mobile/app/pair-confirm.tsx
index 7fef77858bb..c0ec6bc2178 100644
--- a/mobile/app/pair-confirm.tsx
+++ b/mobile/app/pair-confirm.tsx
@@ -1,5 +1,5 @@
import { useCallback, useRef, useState } from 'react'
-import { View, Text, Pressable, ActivityIndicator, BackHandler } from 'react-native'
+import { View, Text, Pressable, BackHandler } from 'react-native'
import { useSafeAreaInsets } from 'react-native-safe-area-context'
import { useFocusEffect, useLocalSearchParams, useRouter } from 'expo-router'
import { ChevronLeft } from 'lucide-react-native'
@@ -13,7 +13,7 @@ import {
} from '../src/transport/pre-profile-pairing-coordinator'
import type { ConnectionLogEntry } from '../src/transport/types'
import { useRefreshHostClient } from '../src/transport/host-client-hooks'
-import { colors, spacing, radii, typography } from '../src/theme/mobile-theme'
+import { colors, spacing, radii, typography, pressedStyle } from '../src/theme/mobile-theme'
import { themedStyleSheet } from '../src/theme/themed-styles'
import { useMobileColorScheme } from '../src/theme/use-mobile-color-scheme'
import { useMobileTranslation } from '../src/i18n/use-mobile-translation'
@@ -22,6 +22,12 @@ import {
loadMobileOnboardingSteps,
mobileOnboardingDestination
} from '../src/onboarding/mobile-onboarding-plan'
+import {
+ PAIRING_SUCCESS_HOLD_MS,
+ PairingProgress,
+ waitForBeat
+} from '../src/pairing/pairing-visuals'
+import { triggerSuccess } from '../src/platform/haptics'
type Status = 'awaiting-confirm' | 'connecting' | 'error'
@@ -46,6 +52,7 @@ function PairConfirmContent({ routeState }: { routeState: PairConfirmRouteState
const refreshHostClient = useRefreshHostClient()
const insets = useSafeAreaInsets()
const [status, setStatus] = useState('awaiting-confirm')
+ const [paired, setPaired] = useState(false)
const [errorMessage, setErrorMessage] = useState('')
const [logs, setLogs] = useState([])
// Ref keeps RPC callback logs current and batches bursty state updates.
@@ -124,7 +131,12 @@ function PairConfirmContent({ routeState }: { routeState: PairConfirmRouteState
}
// Re-pair reuses host id; close cached client so it reloads the persisted endpoint/relay (STA-1840).
refreshHostClient(hostId)
- const onboardingSteps = await loadMobileOnboardingSteps()
+ setPaired(true)
+ triggerSuccess()
+ const [onboardingSteps] = await Promise.all([
+ loadMobileOnboardingSteps(),
+ waitForBeat(PAIRING_SUCCESS_HOLD_MS)
+ ])
if (!mountedRef.current) {
return
}
@@ -160,7 +172,7 @@ function PairConfirmContent({ routeState }: { routeState: PairConfirmRouteState
return (
[styles.backButton, pressed && pressedStyle]}
onPress={cancel}
hitSlop={8}
accessibilityRole="button"
@@ -182,12 +194,18 @@ function PairConfirmContent({ routeState }: { routeState: PairConfirmRouteState
)}
- void confirm()}>
+ [styles.primaryButton, pressed && pressedStyle]}
+ onPress={() => void confirm()}
+ >
{t('app.pairConfirm.pairButton', 'Pair')}
-
+ [styles.secondaryButton, pressed && pressedStyle]}
+ onPress={cancel}
+ >
{t('common.cancel', 'Cancel')}
@@ -196,10 +214,11 @@ function PairConfirmContent({ routeState }: { routeState: PairConfirmRouteState
{resolvedStatus === 'connecting' && (
<>
-
-
- {t('app.pairConfirm.connecting', 'Connecting…')}
-
+
)}
-
+ [styles.primaryButton, pressed && pressedStyle]}
+ onPress={cancel}
+ >
{t('app.pairConfirm.backToHome', 'Back to home')}
diff --git a/mobile/app/pair-scan.tsx b/mobile/app/pair-scan.tsx
index 8ac5223a064..beba933985f 100644
--- a/mobile/app/pair-scan.tsx
+++ b/mobile/app/pair-scan.tsx
@@ -20,7 +20,7 @@ import {
} from '../src/transport/pre-profile-pairing-coordinator'
import type { ConnectionLogEntry, PairingOffer } from '../src/transport/types'
import { useRefreshHostClient } from '../src/transport/host-client-hooks'
-import { colors, spacing } from '../src/theme/mobile-theme'
+import { colors, spacing, pressedStyle } from '../src/theme/mobile-theme'
import { useMobileColorScheme } from '../src/theme/use-mobile-color-scheme'
import { useMobileTranslation } from '../src/i18n/use-mobile-translation'
import { TextInputModal } from '../src/components/TextInputModal'
@@ -30,24 +30,21 @@ import {
mobileOnboardingDestination
} from '../src/onboarding/mobile-onboarding-plan'
import { pairScanStyles as styles } from '../src/pair-scan-styles'
+import {
+ PAIRING_SUCCESS_HOLD_MS,
+ PairingProgress,
+ SCAN_DECODE_BEAT_MS,
+ ScanReticle,
+ Step,
+ waitForBeat
+} from '../src/pairing/pairing-visuals'
+import { triggerSuccess } from '../src/platform/haptics'
// Bound initial pairing at ~25s (one connect timeout plus retry) so broken routes show an actionable error/log; live RPC retries indefinitely.
const PAIRING_OVERALL_TIMEOUT_MS = 25_000
const SCAN_RETICLE_SCALE = 0.62
const SCAN_RETICLE_MAX_SIZE = 360
-function Step({ number, text }: { number: number; text: string }) {
- useMobileColorScheme()
- return (
-
-
- {number}
-
- {text}
-
- )
-}
-
export default function PairScanScreen() {
useMobileColorScheme()
const t = useMobileTranslation()
@@ -56,6 +53,8 @@ export default function PairScanScreen() {
const insets = useSafeAreaInsets()
const [permission, requestPermission, getPermission] = useCameraPermissions()
const [status, setStatus] = useState<'scanning' | 'connecting' | 'error'>('scanning')
+ const [decoded, setDecoded] = useState(false)
+ const [paired, setPaired] = useState(false)
const [errorMessage, setErrorMessage] = useState('')
const [pasteVisible, setPasteVisible] = useState(false)
const [cameraBounds, setCameraBounds] = useState({ width: 0, height: 0 })
@@ -100,7 +99,8 @@ export default function PairScanScreen() {
return
}
- void testAndSave(offer)
+ setDecoded(true)
+ void waitForBeat(SCAN_DECODE_BEAT_MS).then(() => testAndSave(offer))
},
[router, t]
)
@@ -145,6 +145,10 @@ export default function PairScanScreen() {
}, [])
async function testAndSave(offer: PairingOffer) {
+ // A decoded QR waits out the reticle beat; the screen may have left meanwhile.
+ if (!mountedRef.current) {
+ return
+ }
setStatus('connecting')
logsRef.current = []
setLogs([])
@@ -176,7 +180,12 @@ export default function PairScanScreen() {
}
// Re-pair reuses host id; close cached client so it reloads the persisted endpoint/relay (STA-1840).
refreshHostClient(hostId)
- const onboardingSteps = await loadMobileOnboardingSteps()
+ setPaired(true)
+ triggerSuccess()
+ const [onboardingSteps] = await Promise.all([
+ loadMobileOnboardingSteps(),
+ waitForBeat(PAIRING_SUCCESS_HOLD_MS)
+ ])
if (!mountedRef.current) {
return
}
@@ -210,6 +219,7 @@ export default function PairScanScreen() {
function retry() {
setStatus('scanning')
+ setDecoded(false)
setErrorMessage('')
logsRef.current = []
setLogs([])
@@ -240,7 +250,7 @@ export default function PairScanScreen() {
return (
[styles.backButton, pressed && pressedStyle]}
onPress={() => router.back()}
hitSlop={8}
accessibilityRole="button"
@@ -266,7 +276,7 @@ export default function PairScanScreen() {
)}
[styles.primaryButton, pressed && pressedStyle]}
onPress={canAskAgain ? requestPermission : () => void Linking.openSettings()}
>
{canAskAgain && }
@@ -307,7 +317,7 @@ export default function PairScanScreen() {
return (
[styles.backButton, pressed && pressedStyle]}
onPress={() => router.back()}
hitSlop={8}
accessibilityRole="button"
@@ -336,14 +346,7 @@ export default function PairScanScreen() {
barcodeScannerSettings={{ barcodeTypes: ['qr'] }}
onBarcodeScanned={handleBarCodeScanned}
/>
-
-
-
-
-
-
-
-
+
)}
{pasteVisible && }
@@ -361,8 +364,11 @@ export default function PairScanScreen() {
{status === 'connecting' && (
-
- {t('app.pairScan.connecting', 'Connecting…')}
+
@@ -378,7 +384,10 @@ export default function PairScanScreen() {
)}
-
+ [styles.primaryButton, pressed && pressedStyle]}
+ onPress={retry}
+ >
{t('app.pairScan.tryAgain', 'Try Again')}
diff --git a/mobile/app/pair.tsx b/mobile/app/pair.tsx
index 3c4a4fcb6bf..aa49e351313 100644
--- a/mobile/app/pair.tsx
+++ b/mobile/app/pair.tsx
@@ -1,7 +1,7 @@
import { useCallback, useEffect, useState } from 'react'
import { ActivityIndicator, Linking, Pressable, Text, View } from 'react-native'
import { useLocalSearchParams, useRouter } from 'expo-router'
-import { colors, radii, spacing, typography } from '../src/theme/mobile-theme'
+import { colors, radii, spacing, typography, pressedStyle } from '../src/theme/mobile-theme'
import { themedStyleSheet } from '../src/theme/themed-styles'
import { useMobileColorScheme } from '../src/theme/use-mobile-color-scheme'
import { useMobileTranslation } from '../src/i18n/use-mobile-translation'
@@ -51,7 +51,10 @@ export default function PairRedirectScreen() {
{missingCode ? (
<>
{t('app.pair.missingCode', 'Missing pairing code')}
-
+ [styles.primaryButton, pressed && pressedStyle]}
+ onPress={goHome}
+ >
{t('app.pair.backToHome', 'Back to home')}
>
diff --git a/mobile/src/agent-history/AgentHistoryNotices.tsx b/mobile/src/agent-history/AgentHistoryNotices.tsx
index 18a1d41f0ee..1065ae71b0f 100644
--- a/mobile/src/agent-history/AgentHistoryNotices.tsx
+++ b/mobile/src/agent-history/AgentHistoryNotices.tsx
@@ -1,7 +1,7 @@
import { useState } from 'react'
import { Pressable, ScrollView, Text, View } from 'react-native'
import { TriangleAlert, X } from 'lucide-react-native'
-import { colors, radii, spacing, typography } from '../theme/mobile-theme'
+import { colors, radii, spacing, typography, pressedStyle } from '../theme/mobile-theme'
import { themedStyleSheet } from '../theme/themed-styles'
import { useMobileColorScheme } from '../theme/use-mobile-color-scheme'
import { useMobileTranslation } from '../i18n/use-mobile-translation'
@@ -28,6 +28,7 @@ export function AgentHistorySkippedNotice({ issues }: { issues: readonly Transcr
: t('agentHistory.panel.skipped_other', '{{count}} transcripts skipped', { count })}
pressed && pressedStyle}
onPress={() => setShown((value) => !value)}
hitSlop={10}
accessibilityRole="button"
@@ -71,6 +72,7 @@ export function AgentHistoryResumeNotice({
{message}
pressed && pressedStyle}
onPress={onDismiss}
hitSlop={12}
accessibilityRole="button"
diff --git a/mobile/src/automations/AutomationControls.tsx b/mobile/src/automations/AutomationControls.tsx
index 41a518c1ca3..3587477f181 100644
--- a/mobile/src/automations/AutomationControls.tsx
+++ b/mobile/src/automations/AutomationControls.tsx
@@ -3,7 +3,7 @@ import { useMobileColorScheme } from '../theme/use-mobile-color-scheme'
import { useState } from 'react'
import { Pressable, Text, TextInput, View } from 'react-native'
import { PickerModal, type PickerOption } from '../components/PickerModal'
-import { colors } from '../theme/mobile-theme'
+import { colors, pressedStyle } from '../theme/mobile-theme'
import { automationStyles as styles } from './automation-styles'
export function AutomationButton(props: {
@@ -20,10 +20,11 @@ export function AutomationButton(props: {
accessibilityState={{ disabled: props.disabled }}
disabled={props.disabled}
onPress={props.onPress}
- style={[
+ style={({ pressed }) => [
styles.button,
props.primary && styles.primaryButton,
- props.disabled && styles.disabled
+ props.disabled && styles.disabled,
+ pressed && pressedStyle
]}
>
props.onOpen(row)}
- style={styles.grow}
+ style={({ pressed }) => [styles.grow, pressed && pressedStyle]}
>
{automation.name}
diff --git a/mobile/src/automations/AutomationRunList.tsx b/mobile/src/automations/AutomationRunList.tsx
index cb59b7ea832..f6f3de9506d 100644
--- a/mobile/src/automations/AutomationRunList.tsx
+++ b/mobile/src/automations/AutomationRunList.tsx
@@ -2,7 +2,7 @@ import { useMobileTranslation } from '../i18n/use-mobile-translation'
import { useMobileColorScheme } from '../theme/use-mobile-color-scheme'
import { Pressable, Text, View } from 'react-native'
import { ChevronRight } from 'lucide-react-native'
-import { colors } from '../theme/mobile-theme'
+import { colors, pressedStyle } from '../theme/mobile-theme'
import type { MobileAutomationRun } from './automation-reply-schema'
import { AutomationButton } from './AutomationControls'
import type { AutomationRunObservation } from './use-automation-runs'
@@ -66,7 +66,7 @@ export function AutomationRunList(props: {
}
)}
onPress={() => props.onSelect(run)}
- style={styles.card}
+ style={({ pressed }) => [styles.card, pressed && pressedStyle]}
>
{run.title}
diff --git a/mobile/src/automations/MobileAutomationsScreen.tsx b/mobile/src/automations/MobileAutomationsScreen.tsx
index 7f25ad3481c..5487d7593a0 100644
--- a/mobile/src/automations/MobileAutomationsScreen.tsx
+++ b/mobile/src/automations/MobileAutomationsScreen.tsx
@@ -11,7 +11,7 @@ import { useRouteHandoff } from '../navigation/route-handoff'
import { useHostClient } from '../transport/host-client-hooks'
import { useHostProtocolGates } from '../components/host-protocol-gates-context'
import { useReachableServerClients } from '../worktree/use-reachable-server-clients'
-import { colors } from '../theme/mobile-theme'
+import { colors, pressedStyle } from '../theme/mobile-theme'
import { AutomationChoice } from './AutomationControls'
import { AutomationManager } from './AutomationManager'
import { automationStyles as styles } from './automation-styles'
@@ -34,6 +34,7 @@ export function MobileAutomationsScreen() {
pressed && pressedStyle}
accessibilityRole="button"
accessibilityLabel={t('automations.mobile.back', 'Back')}
onPress={() => router.back()}
diff --git a/mobile/src/browser/MobileBrowserPaneView.tsx b/mobile/src/browser/MobileBrowserPaneView.tsx
index b3552315824..60878e5a923 100644
--- a/mobile/src/browser/MobileBrowserPaneView.tsx
+++ b/mobile/src/browser/MobileBrowserPaneView.tsx
@@ -12,7 +12,7 @@ import {
} from 'react-native'
import { ArrowUp, ChevronLeft, ChevronRight, RefreshCw } from 'lucide-react-native'
import { useMobileTranslation } from '../i18n/use-mobile-translation'
-import { colors } from '../theme/mobile-theme'
+import { colors, pressedStyle } from '../theme/mobile-theme'
import { useMobileColorScheme } from '../theme/use-mobile-color-scheme'
import { MobileBrowserAddressField } from './MobileBrowserAddressField'
import { MobileBrowserKeyRow } from './MobileBrowserKeyRow'
@@ -326,7 +326,11 @@ export function MobileBrowserPaneView(props: MobileBrowserPaneViewProps) {
onSubmitEditing={() => void sendKeyboardText()}
/>
[
+ styles.sendButton,
+ (controlsDisabled || !keyboardValue) && styles.disabled,
+ pressed && pressedStyle
+ ]}
disabled={controlsDisabled || !keyboardValue}
onPress={() => void sendKeyboardText()}
accessibilityLabel={t('browser.paneView.sendText', 'Send text to browser')}
diff --git a/mobile/src/components/AgentLaunchNotice.tsx b/mobile/src/components/AgentLaunchNotice.tsx
index 804fd5cbb49..ce88b634795 100644
--- a/mobile/src/components/AgentLaunchNotice.tsx
+++ b/mobile/src/components/AgentLaunchNotice.tsx
@@ -3,7 +3,7 @@ import { Pressable, Text, View, type StyleProp, type TextStyle } from 'react-nat
import { useClipboardWriter } from '../platform/clipboard'
import { useMobileTranslation } from '../i18n/use-mobile-translation'
import type { MobileAgentLaunchAvailability } from '../session/mobile-agent-launch-availability'
-import { colors, spacing, typography } from '../theme/mobile-theme'
+import { colors, spacing, typography, pressedStyle } from '../theme/mobile-theme'
import { themedStyleSheet } from '../theme/themed-styles'
import { useMobileColorScheme } from '../theme/use-mobile-color-scheme'
@@ -66,6 +66,7 @@ export function AgentLaunchNotice({
{note ? {note} : null}
{undeliveredPrompt ? (
pressed && pressedStyle}
onPress={() => {
clipboard.writeText(undeliveredPrompt).then(
() => setCopyState({ prompt: undeliveredPrompt, status: 'copied' }),
diff --git a/mobile/src/components/AgentSpinner.tsx b/mobile/src/components/AgentSpinner.tsx
index d2e2bbe9ee1..3489681d572 100644
--- a/mobile/src/components/AgentSpinner.tsx
+++ b/mobile/src/components/AgentSpinner.tsx
@@ -1,12 +1,12 @@
import { Activity } from 'lucide-react-native'
-import { Animated, View } from 'react-native'
+import { View } from 'react-native'
import type { AgentWorkingMode } from '../../../src/shared/agent-status-types'
import type { WorktreeStatus } from '../../../src/shared/worktree-status-rollup'
import { useMobileTranslation } from '../i18n/use-mobile-translation'
import { colors, radii } from '../theme/mobile-theme'
import { themedStyleSheet } from '../theme/themed-styles'
import { useMobileColorScheme } from '../theme/use-mobile-color-scheme'
-import { useWorkingRingRotation } from './use-working-ring-rotation'
+import { WorkingRing } from './AgentStateDot'
// Match desktop sidebar StatusIndicator colors/sizes for the worktree rollup; palette distinguishes moving/alive/completed states.
export const agentStatusColors = (): Record => ({
@@ -32,7 +32,6 @@ export function AgentSpinner({
useMobileColorScheme()
const monitoring =
status === 'monitoring' || (status === 'working' && workingMode === 'monitoring')
- const rotate = useWorkingRingRotation(status === 'working' && !monitoring)
const palette = agentStatusColors()
const color = palette[status] ?? palette.inactive
@@ -62,7 +61,7 @@ export function AgentSpinner({
if (status === 'working') {
return (
-
+
)
}
diff --git a/mobile/src/components/AgentStateDot.tsx b/mobile/src/components/AgentStateDot.tsx
index 7a4521396ee..3b3cf613186 100644
--- a/mobile/src/components/AgentStateDot.tsx
+++ b/mobile/src/components/AgentStateDot.tsx
@@ -1,11 +1,12 @@
import { Activity } from 'lucide-react-native'
-import { Animated, View } from 'react-native'
+import { Animated, View, type ViewStyle } from 'react-native'
import type { AgentDotState } from '../worktree/agent-row-display'
import { useMobileTranslation } from '../i18n/use-mobile-translation'
import { colors, radii } from '../theme/mobile-theme'
import { themedStyleSheet } from '../theme/themed-styles'
import { useMobileColorScheme } from '../theme/use-mobile-color-scheme'
-import { useWorkingRingRotation } from './use-working-ring-rotation'
+import { useReducedMotionEnabled } from '../platform/use-reduced-motion'
+import { useWorkingRingRotation } from './use-working-motion'
// Match desktop per-agent vocabulary: working yellow spinner, done emerald, attention red, interrupted muted, unconfirmed amber, idle neutral.
// Separate from AgentSpinner’s five-state worktree rollup.
@@ -23,17 +24,29 @@ const dotColors = (): Record<
})
export const AGENT_WORKING_COLOR = '#eab308'
+/** Spins only while mounted, so idle rows hold no loop; Reduce Motion closes the gap, as desktop does. */
+export function WorkingRing({ color, style }: { color: string; style: ViewStyle }) {
+ // Unknown counts as reduced, the same as LoadingSpinner.
+ const still = useReducedMotionEnabled() !== false
+ const ring = useWorkingRingRotation(!still)
+ return (
+
+ )
+}
+
/** `unverifiable` is a child row's lost contact: desktop's dashed amber ring, a missing-evidence
* mark rather than a state claim. */
export function AgentStateDot({ state }: { state: AgentDotState | 'unverifiable' }) {
const t = useMobileTranslation()
useMobileColorScheme()
- const rotate = useWorkingRingRotation(state === 'working')
if (state === 'working') {
return (
-
+
)
}
@@ -83,7 +96,6 @@ const styles = themedStyleSheet(() => ({
height: 6,
borderRadius: radii.pill,
borderWidth: 1.5,
- borderColor: AGENT_WORKING_COLOR,
borderTopColor: 'transparent'
}
}))
diff --git a/mobile/src/components/AuthFailedBannerActions.tsx b/mobile/src/components/AuthFailedBannerActions.tsx
index c72ff2c5924..df3ae82df72 100644
--- a/mobile/src/components/AuthFailedBannerActions.tsx
+++ b/mobile/src/components/AuthFailedBannerActions.tsx
@@ -1,6 +1,6 @@
import { Pressable, Text } from 'react-native'
import { useMobileTranslation } from '../i18n/use-mobile-translation'
-import { colors } from '../theme/mobile-theme'
+import { colors, pressedStyle } from '../theme/mobile-theme'
import { useMobileColorScheme } from '../theme/use-mobile-color-scheme'
import { authFailedBannerStyles as styles } from './auth-failed-banner-styles'
@@ -21,16 +21,25 @@ export function AuthFailedBannerActions({
return (
<>
{canRetry && (
-
+ [styles.action, pressed && pressedStyle]}
+ onPress={onRetry}
+ >
{t('common.retry', 'Retry')}
)}
-
+ [styles.action, pressed && pressedStyle]}
+ onPress={onRepair}
+ >
{t('components.authFailedBannerActions.repair', 'Re-pair')}
-
+ [styles.action, pressed && pressedStyle]}
+ onPress={onRemove}
+ >
{t('common.remove', 'Remove')}
diff --git a/mobile/src/components/AuthFailedBannerActions.web.tsx b/mobile/src/components/AuthFailedBannerActions.web.tsx
index 312ea488852..abff871bd6c 100644
--- a/mobile/src/components/AuthFailedBannerActions.web.tsx
+++ b/mobile/src/components/AuthFailedBannerActions.web.tsx
@@ -2,6 +2,7 @@ import { Pressable, Text } from 'react-native'
import { useMobileTranslation } from '../i18n/use-mobile-translation'
import { authFailedBannerStyles as styles } from './auth-failed-banner-styles'
import { useMobileColorScheme } from '../theme/use-mobile-color-scheme'
+import { pressedStyle } from '../theme/mobile-theme'
// Offer shell-routed /pair-scan only; web forceReconnect is null and page-host-removal-refusal rejects Remove, so direct users to app for both.
export function AuthFailedBannerActions({
@@ -16,7 +17,10 @@ export function AuthFailedBannerActions({
useMobileColorScheme()
return (
<>
-
+ [styles.action, pressed && pressedStyle]}
+ onPress={onRepair}
+ >
{t('components.authFailedBannerActions.repair', 'Re-pair')}
diff --git a/mobile/src/components/AutoHeight.tsx b/mobile/src/components/AutoHeight.tsx
index 487ca088e3f..954deb73654 100644
--- a/mobile/src/components/AutoHeight.tsx
+++ b/mobile/src/components/AutoHeight.tsx
@@ -9,6 +9,8 @@ import Animated, {
} from 'react-native-reanimated'
import { useReducedMotionEnabled } from '../platform/use-reduced-motion'
import { BOTTOM_DRAWER_EASING, BOTTOM_DRAWER_HEIGHT_DURATION_MS } from './bottom-drawer-constants'
+// The same 200 ms as Reduce Motion's cross-fade: content fades while its box eases.
+import { REDUCED_MOTION_FADE_MS as CONTENT_FADE_MS } from './sheet-motion-values'
const HEIGHT_TIMING = { duration: BOTTOM_DRAWER_HEIGHT_DURATION_MS, easing: BOTTOM_DRAWER_EASING }
@@ -80,6 +82,45 @@ export function AutoHeight({ children, maxHeight, open = true }: AutoHeightProps
)
}
+/**
+ * A banner that comes and goes: pass it as the child, or nothing to hide it. Its box eases open
+ * and closed while the content fades, and the last banner stays drawn while it leaves.
+ * `animateHeight={false}` resizes once instead, for content above a terminal or page whose every
+ * resize refits it.
+ */
+export function Presence({
+ children,
+ animateHeight = true
+}: {
+ children: ReactNode
+ animateHeight?: boolean
+}) {
+ const shown = children !== null && children !== undefined && children !== false
+ const [last, setLast] = useState(shown ? children : null)
+ if (shown && last !== children) {
+ setLast(children)
+ }
+ const [present, setPresent] = useState(shown)
+ if (shown && !present) {
+ setPresent(true)
+ }
+ const opacity = useSharedValue(shown ? 1 : 0)
+ useEffect(() => {
+ opacity.value = withTiming(shown ? 1 : 0, { duration: CONTENT_FADE_MS }, (finished) => {
+ if (finished && !shown) {
+ runOnJS(setPresent)(false)
+ }
+ })
+ }, [opacity, shown])
+ // The page bundle has no worklet plugin, so web mappers read only the dependency list.
+ const fadeStyle = useAnimatedStyle(() => ({ opacity: opacity.value }), [opacity])
+ const content = {shown ? children : last}
+ if (animateHeight) {
+ return {content}
+ }
+ return present ? content : null
+}
+
function easeHeight(
height: SharedValue,
next: number,
diff --git a/mobile/src/components/CustomKeyModal.tsx b/mobile/src/components/CustomKeyModal.tsx
index b8b0870fe7c..1605e93f31b 100644
--- a/mobile/src/components/CustomKeyModal.tsx
+++ b/mobile/src/components/CustomKeyModal.tsx
@@ -1,7 +1,7 @@
import { useCallback, useMemo, useState } from 'react'
import { View, Text, Pressable, TextInput } from 'react-native'
import { ChevronLeft } from 'lucide-react-native'
-import { colors } from '../theme/mobile-theme'
+import { colors, pressedStyle } from '../theme/mobile-theme'
import { useMobileColorScheme } from '../theme/use-mobile-color-scheme'
import { BottomDrawer } from './BottomDrawer'
import { TextField } from './composer-input/TextField'
@@ -310,7 +310,11 @@ export function CustomKeyModal({ visible, onClose, onKeysChanged, onManageShortc
[
+ styles.saveButton,
+ !shortcutPreview && styles.saveButtonDisabled,
+ pressed && pressedStyle
+ ]}
disabled={!shortcutPreview}
onPress={handleShortcutSave}
>
@@ -394,7 +398,11 @@ export function CustomKeyModal({ visible, onClose, onKeysChanged, onManageShortc
/>
[
+ styles.saveButton,
+ !macroText.trim() && styles.saveButtonDisabled,
+ pressed && pressedStyle
+ ]}
disabled={!macroText.trim()}
onPress={handleMacroSave}
>
diff --git a/mobile/src/components/DragReorderList.surfaces.test.tsx b/mobile/src/components/DragReorderList.surfaces.test.tsx
index 4420d55f8e5..13f6435753f 100644
--- a/mobile/src/components/DragReorderList.surfaces.test.tsx
+++ b/mobile/src/components/DragReorderList.surfaces.test.tsx
@@ -24,6 +24,9 @@ it('places a coherent measured append directly, but springs a dragged row back i
root!.root.findAll((node) => node.type === Animated.View && node.props.onLayout)
const measureRow = (at: number) =>
rows()[at]!.props.onLayout({ nativeEvent: { layout: { height: 44 } } })
+ // Rows move by their first transform, not by top.
+ const y = ({ transform }: Record) =>
+ Array.isArray(transform) ? transform[0]?.translateY : undefined
const frame = () => {
probe.reactions.forEach((react) => react())
return [...probe.styles.values()].map((read) => read())
@@ -33,10 +36,10 @@ it('places a coherent measured append directly, but springs a dragged row back i
measureRow(1)
})
await publishLayout()
- expect(frame().map((style) => style.top)).toEqual([0, 44])
+ expect(frame().map(y)).toEqual([0, 44])
expect(probe.spring).not.toHaveBeenCalled()
await act(async () => root!.update(createElement(Harness, { ids: ['a', 'b', 'c'] })))
- expect(frame().map((style) => [style.position, style.top])).toEqual([
+ expect(frame().map((style) => [style.position, y(style)])).toEqual([
['relative', 0],
['relative', 0],
['relative', 0]
@@ -50,9 +53,9 @@ it('places a coherent measured append directly, but springs a dragged row back i
const coherent = measurement.value
// React is ready, but the UI thread still has the previous measurement publication.
measurement.value = earlier
- expect(frame().every((style) => style.position === 'relative' && style.top === 0)).toBe(true)
+ expect(frame().every((style) => style.position === 'relative' && y(style) === 0)).toBe(true)
measurement.value = coherent
- expect(frame().map((style) => [style.position, style.top])).toEqual([
+ expect(frame().map((style) => [style.position, y(style)])).toEqual([
['absolute', 0],
['absolute', 44],
['absolute', 88]
@@ -63,9 +66,9 @@ it('places a coherent measured append directly, but springs a dragged row back i
gesture.start!({ absoluteY: 60, translationY: 0 }, true)
gesture.update!({ absoluteY: 70, translationY: 10 }, true)
})
- expect(frame()[1]!.top).toBe(54)
+ expect(y(frame()[1]!)).toBe(54)
await act(async () => gesture.finalize!({ absoluteY: 70, translationY: 10 }, true))
- expect(frame()[1]!.top).toBe(44)
+ expect(y(frame()[1]!)).toBe(44)
expect(probe.spring).toHaveBeenCalledExactlyOnceWith(44, expect.any(Object))
await act(async () => root!.unmount())
})
diff --git a/mobile/src/components/DragReorderRow.tsx b/mobile/src/components/DragReorderRow.tsx
index fac38111642..af8102eee38 100644
--- a/mobile/src/components/DragReorderRow.tsx
+++ b/mobile/src/components/DragReorderRow.tsx
@@ -3,11 +3,14 @@ import { StyleSheet, View } from 'react-native'
import { Gesture, GestureDetector } from 'react-native-gesture-handler'
import { GripVertical } from 'lucide-react-native'
import Animated, {
+ Easing,
+ interpolateColor,
runOnJS,
useAnimatedStyle,
useAnimatedReaction,
useSharedValue,
withSpring,
+ withTiming,
type DerivedValue,
type SharedValue
} from 'react-native-reanimated'
@@ -24,6 +27,13 @@ import {
// Critically damped: Reanimated 4's default mass of 4 made the old damping/stiffness pair wobble.
const ROW_SPRING = { dampingRatio: 1, duration: 250 } as const
const LONG_PRESS_ACTIVATION_MS = 200
+const LIFT_MS = 150
+
+// Built per call: a module-level easing would run before a test's Reanimated mock can serve it.
+function liftTo(value: 0 | 1) {
+ 'worklet'
+ return withTiming(value, { duration: LIFT_MS, easing: Easing.out(Easing.cubic) })
+}
export type DragSharedState = {
layout: DerivedValue
@@ -88,6 +98,8 @@ export function DragReorderRow({
// Settings rows rest on their ListGroup's surface.
const restingBackground = colors.sheetGroup
+ // 0 rests, 1 is picked up: the lift eases in and out instead of snapping.
+ const lift = useSharedValue(0)
const pan = Gesture.Pan()
.enabled(ready && movable && !disabled)
.activateAfterLongPress(LONG_PRESS_ACTIVATION_MS)
@@ -100,6 +112,7 @@ export function DragReorderRow({
dragPointerAbsY.value = event.absoluteY
activeTop.value = dragStartTop.value
activeKey.value = rowKey
+ lift.value = liftTo(1)
runOnJS(onDragActiveChange)(true)
runOnJS(triggerMediumImpact)()
})
@@ -116,6 +129,7 @@ export function DragReorderRow({
return
}
activeKey.value = null
+ lift.value = liftTo(0)
if (success) {
const orderedKeys = orderedKeysFromDragReorderPositions(positions.value)
runOnJS(onCommit)(orderedKeys, rowKey, true)
@@ -144,28 +158,24 @@ export function DragReorderRow({
},
[ready, layout, measurementKey, activeKey, rowKey, activeTop, rowTop]
)
+ // Rows sit at the top and move by transform, so a drag never lays the list out per frame.
const rowStyle = useAnimatedStyle(() => {
const placed = ready && layout.value.ready && layout.value.measurementKey === measurementKey
- const placement = { position: placed ? ('absolute' as const) : ('relative' as const) }
- if (activeKey.value === rowKey) {
- return {
- ...placement,
- top: placed ? activeTop.value : 0,
- zIndex: 2,
- elevation: presentation === 'settings' ? 4 : 0,
- shadowOpacity: presentation === 'settings' ? 0.3 : 0,
- backgroundColor: presentation === 'settings' ? activeBackground : undefined,
- transform: [{ scale: presentation === 'settings' ? 1.02 : 1 }]
- }
- }
+ const active = activeKey.value === rowKey
+ const raised = presentation === 'settings' ? lift.value : 0
+ const y = !placed ? 0 : active ? activeTop.value : rowTop.value
return {
- ...placement,
- top: placed ? rowTop.value : 0,
- zIndex: 0,
- elevation: 0,
- shadowOpacity: 0,
- backgroundColor: presentation === 'settings' ? restingBackground : undefined,
- transform: [{ scale: 1 }]
+ position: placed ? ('absolute' as const) : ('relative' as const),
+ top: 0,
+ // Stay above neighbours while the lift eases off.
+ zIndex: active || lift.value > 0 ? 2 : 0,
+ elevation: 4 * raised,
+ shadowOpacity: 0.3 * raised,
+ backgroundColor:
+ presentation === 'settings'
+ ? interpolateColor(lift.value, [0, 1], [restingBackground, activeBackground])
+ : undefined,
+ transform: [{ translateY: y }, { scale: 1 + 0.02 * raised }]
}
}, [
layout,
@@ -176,6 +186,7 @@ export function DragReorderRow({
measurementKey,
presentation,
rowTop,
+ lift,
activeBackground,
restingBackground
])
diff --git a/mobile/src/components/HostDiagnosticsLink.tsx b/mobile/src/components/HostDiagnosticsLink.tsx
index d0b0e911c75..a15351b9d19 100644
--- a/mobile/src/components/HostDiagnosticsLink.tsx
+++ b/mobile/src/components/HostDiagnosticsLink.tsx
@@ -1,6 +1,6 @@
import { ChevronRight } from 'lucide-react-native'
import { Pressable, Text } from 'react-native'
-import { colors, radii, spacing, typography } from '../theme/mobile-theme'
+import { colors, radii, spacing, typography, pressedStyle } from '../theme/mobile-theme'
import { themedStyleSheet } from '../theme/themed-styles'
import { useMobileColorScheme } from '../theme/use-mobile-color-scheme'
import { useMobileTranslation } from '../i18n/use-mobile-translation'
@@ -10,7 +10,7 @@ export function HostDiagnosticsLink({ onPress }: { onPress: () => void }): React
const t = useMobileTranslation()
return (
[styles.link, pressed && pressedStyle]}
onPress={onPress}
accessibilityRole="button"
accessibilityLabel={t(
diff --git a/mobile/src/components/HostRouteNoticeBanner.tsx b/mobile/src/components/HostRouteNoticeBanner.tsx
index 2fd7f021aa0..fc90d1184d9 100644
--- a/mobile/src/components/HostRouteNoticeBanner.tsx
+++ b/mobile/src/components/HostRouteNoticeBanner.tsx
@@ -1,6 +1,6 @@
import { Pressable, Text, View } from 'react-native'
import { X } from 'lucide-react-native'
-import { colors, spacing } from '../theme/mobile-theme'
+import { colors, spacing, pressedStyle } from '../theme/mobile-theme'
import { themedStyleSheet } from '../theme/themed-styles'
import { useMobileColorScheme } from '../theme/use-mobile-color-scheme'
import { useMobileTranslation } from '../i18n/use-mobile-translation'
@@ -28,7 +28,12 @@ export function HostRouteNoticeBanner({
>
{message}
{action ? (
-
+ pressed && pressedStyle}
+ onPress={action.onPress}
+ accessibilityRole="button"
+ hitSlop={spacing.sm}
+ >
{action.label}
) : null}
@@ -38,7 +43,7 @@ export function HostRouteNoticeBanner({
accessibilityRole="button"
accessibilityLabel={t('components.hostRouteNoticeBanner.dismissNotice', 'Dismiss notice')}
hitSlop={spacing.sm}
- style={styles.dismiss}
+ style={({ pressed }) => [styles.dismiss, pressed && pressedStyle]}
>
diff --git a/mobile/src/components/LoadingSpinner.tsx b/mobile/src/components/LoadingSpinner.tsx
index 96386fd66b8..5b2cd44e925 100644
--- a/mobile/src/components/LoadingSpinner.tsx
+++ b/mobile/src/components/LoadingSpinner.tsx
@@ -1,7 +1,7 @@
import { Animated } from 'react-native'
import { Hourglass, LoaderCircle } from 'lucide-react-native'
import { useReducedMotionEnabled } from '../platform/use-reduced-motion'
-import { useWorkingRingRotation } from './use-working-ring-rotation'
+import { useWorkingRingRotation } from './use-working-motion'
// Match desktop one-second spinner; reduced motion uses distinct working icon so frozen circle does not look stuck.
export function LoadingSpinner({
@@ -12,12 +12,12 @@ export function LoadingSpinner({
color: string
}): React.JSX.Element {
const reducedMotion = useReducedMotionEnabled()
- const rotate = useWorkingRingRotation(reducedMotion === false)
+ const ring = useWorkingRingRotation(reducedMotion === false)
if (reducedMotion) {
return
}
return (
-
+
)
diff --git a/mobile/src/components/MobilePreviewSourceTabs.tsx b/mobile/src/components/MobilePreviewSourceTabs.tsx
index 768dd2e7881..996f5bc0cf3 100644
--- a/mobile/src/components/MobilePreviewSourceTabs.tsx
+++ b/mobile/src/components/MobilePreviewSourceTabs.tsx
@@ -1,7 +1,7 @@
import { Pressable, Text, View } from 'react-native'
import { Code, Eye } from 'lucide-react-native'
import { useMobileTranslation } from '../i18n/use-mobile-translation'
-import { colors, radii, spacing, typography } from '../theme/mobile-theme'
+import { colors, radii, spacing, typography, pressedStyle } from '../theme/mobile-theme'
import { themedStyleSheet } from '../theme/themed-styles'
import { useMobileColorScheme } from '../theme/use-mobile-color-scheme'
@@ -21,7 +21,11 @@ export function MobilePreviewSourceTabs({ mode, onModeChange, previewLabel, sour
// Expose selected tab to assistive readers; active styling alone is silent.
[
+ styles.toggle,
+ mode === 'preview' && styles.toggleActive,
+ pressed && pressedStyle
+ ]}
onPress={() => onModeChange('preview')}
accessibilityRole="tab"
// Set both native accessibilityState and web aria-selected: RN Web drops former without emitting latter.
@@ -33,7 +37,11 @@ export function MobilePreviewSourceTabs({ mode, onModeChange, previewLabel, sour
{t('components.htmlPreview.preview', 'Preview')}
[
+ styles.toggle,
+ mode === 'source' && styles.toggleActive,
+ pressed && pressedStyle
+ ]}
onPress={() => onModeChange('source')}
accessibilityRole="tab"
accessibilityState={{ selected: mode === 'source' }}
diff --git a/mobile/src/components/MobileStateView.tsx b/mobile/src/components/MobileStateView.tsx
index 2d5e08a28c4..ccdaa63c9a6 100644
--- a/mobile/src/components/MobileStateView.tsx
+++ b/mobile/src/components/MobileStateView.tsx
@@ -2,7 +2,7 @@ import { useState, type ReactNode } from 'react'
import { ActivityIndicator, Pressable, StyleSheet, Text, View } from 'react-native'
import { CircleAlert, SearchX, WifiOff, type LucideIcon } from 'lucide-react-native'
import { useMobileTranslation } from '../i18n/use-mobile-translation'
-import { colors, feedback, radii, spacing, typography } from '../theme/mobile-theme'
+import { colors, feedback, radii, spacing, typography, pressedStyle } from '../theme/mobile-theme'
import { themedStyleSheet } from '../theme/themed-styles'
import { useMobileColorScheme } from '../theme/use-mobile-color-scheme'
import { describeLoadError } from './load-error-description'
@@ -74,6 +74,7 @@ function MobileStateDetails({ details }: { details: string }) {
return (
<>
pressed && pressedStyle}
onPress={() => setOpen(!open)}
hitSlop={8}
accessibilityRole="button"
diff --git a/mobile/src/components/NativeScreenRecovery.tsx b/mobile/src/components/NativeScreenRecovery.tsx
index 2ef99aab274..f47fbabb54f 100644
--- a/mobile/src/components/NativeScreenRecovery.tsx
+++ b/mobile/src/components/NativeScreenRecovery.tsx
@@ -4,7 +4,7 @@ import { useRouter, useSegments, type ErrorBoundaryProps } from 'expo-router'
import { discardInitialLaunchIntent } from '../navigation/initial-launch-intent'
import { recordNativeRenderError } from '../diagnostics/native-render-log'
import { useMobileTranslation } from '../i18n/use-mobile-translation'
-import { colors, radii, spacing, typography } from '../theme/mobile-theme'
+import { colors, radii, spacing, typography, pressedStyle } from '../theme/mobile-theme'
import { themedStyleSheet } from '../theme/themed-styles'
import { useMobileColorScheme } from '../theme/use-mobile-color-scheme'
@@ -23,14 +23,18 @@ export function NativeScreenRecovery({ error, retry }: ErrorBoundaryProps) {
{t('components.nativeScreenRecovery.title', 'Something went wrong')}
- void retry()}>
+ [styles.retryButton, pressed && pressedStyle]}
+ onPress={() => void retry()}
+ >
{t('components.nativeScreenRecovery.tryAgain', 'Try again')}
[styles.homeButton, pressed && pressedStyle]}
onPress={() => {
discardInitialLaunchIntent()
router.replace('/')
diff --git a/mobile/src/components/NewWorkspaceSshConnectionField.tsx b/mobile/src/components/NewWorkspaceSshConnectionField.tsx
index 1580025fff8..b85a8506122 100644
--- a/mobile/src/components/NewWorkspaceSshConnectionField.tsx
+++ b/mobile/src/components/NewWorkspaceSshConnectionField.tsx
@@ -4,6 +4,7 @@ import type { WorkspaceSshGate } from '../tasks/workspace-ssh-gate'
import { workspaceSshStatusLabel } from '../tasks/workspace-ssh-gate'
import { newWorktreeFormStyles as styles } from './new-worktree-form-styles'
import { useMobileColorScheme } from '../theme/use-mobile-color-scheme'
+import { pressedStyle } from '../theme/mobile-theme'
export function NewWorkspaceSshConnectionField({
repoName,
@@ -41,7 +42,11 @@ export function NewWorkspaceSshConnectionField({
{sshGate.status === 'connected' ? null : (
[
+ styles.sshConnectButton,
+ sshGate.connectInProgress && styles.disabled,
+ pressed && pressedStyle
+ ]}
disabled={sshGate.connectInProgress}
onPress={onConnect}
>
diff --git a/mobile/src/components/RightDrawer.tsx b/mobile/src/components/RightDrawer.tsx
index 62e1e9e9c13..a87ca942827 100644
--- a/mobile/src/components/RightDrawer.tsx
+++ b/mobile/src/components/RightDrawer.tsx
@@ -1,16 +1,8 @@
-import { type ReactNode, useCallback, useEffect, useState } from 'react'
+import { type ReactNode, useEffect, useMemo, useState } from 'react'
import { View, Pressable, StyleSheet, Platform, Keyboard } from 'react-native'
import { useSafeAreaFrame, useSafeAreaInsets } from 'react-native-safe-area-context'
import { Gesture, GestureDetector, GestureHandlerRootView } from 'react-native-gesture-handler'
-import Animated, {
- useSharedValue,
- useAnimatedStyle,
- withSpring,
- withTiming,
- runOnJS,
- interpolate,
- Extrapolation
-} from 'react-native-reanimated'
+import Animated, { useSharedValue, useAnimatedStyle } from 'react-native-reanimated'
import { useBackClaim } from '../navigation/use-back-claim'
import { colors, radii, spacing } from '../theme/mobile-theme'
import { themedStyleSheet } from '../theme/themed-styles'
@@ -18,15 +10,15 @@ import { useMobileColorScheme } from '../theme/use-mobile-color-scheme'
// Reuse BottomDrawer’s anchor-independent mount-before-commit gate.
import { resolveBottomDrawerMounted } from './bottom-drawer-mount-state'
import { resolveRightDrawerPanelWidth } from './right-drawer-panel-width'
-import { SETTLE_SPRING } from './sheet-motion-values'
+import {
+ bottomDrawerOffset,
+ bottomDrawerScrim,
+ bottomDrawerTravel
+} from './bottom-drawer-drag-motion'
+import { hideDrawer, showDrawer, useDrawerDrag } from './use-bottom-drawer-drag'
+import { useDrawerReducedMotion } from './bottom-drawer-constants'
import { useResponsiveLayout } from '../layout/responsive-layout'
-const DISMISS_THRESHOLD = 80
-// Damp negative translateX so panel resists pulling inward past docked edge.
-const RUBBER_BAND_FACTOR = 0.25
-const SHOW_DURATION = 180
-const HIDE_DURATION = 150
-
type Props = {
visible: boolean
onClose: () => void
@@ -75,24 +67,26 @@ function MountedRightDrawer({
widthPx
}: MountedRightDrawerProps) {
useMobileColorScheme()
- const translateX = useSharedValue(0)
const progress = useSharedValue(0)
+ const fade = useSharedValue(0)
+ const reducedMotion = useDrawerReducedMotion()
+ const motion = useMemo(() => ({ progress, fade, reducedMotion }), [progress, fade, reducedMotion])
const { width: screenWidth } = useSafeAreaFrame()
const insets = useSafeAreaInsets()
const { isWideLayout } = useResponsiveLayout()
const panelWidth = resolveRightDrawerPanelWidth(screenWidth, isWideLayout, widthPx)
+ const extent = useSharedValue(panelWidth)
+ useEffect(() => {
+ extent.value = panelWidth
+ }, [extent, panelWidth])
+ // The panel moves like the bottom sheet, on its own axis: one value, the same curve and release.
useEffect(() => {
if (visible) {
- translateX.value = 0
- progress.value = withTiming(1, { duration: SHOW_DURATION })
+ showDrawer(motion)
} else {
Keyboard.dismiss()
- progress.value = withTiming(0, { duration: HIDE_DURATION }, (finished) => {
- if (finished) {
- runOnJS(onHidden)()
- }
- })
+ hideDrawer(motion, onHidden)
}
}, [onHidden, visible])
@@ -106,53 +100,29 @@ function MountedRightDrawer({
: null
)
- const dismiss = useCallback(() => {
- onClose()
- }, [onClose])
-
+ const drag = useDrawerDrag({ ...motion, extent, screenExtent: screenWidth, onDismiss: onClose })
const scrollGesture = Gesture.Native()
// Positive horizontal swipe dismisses; activeOffset leaves vertical ScrollView gestures intact.
const panGesture = Gesture.Pan()
.activeOffsetX([-8, 8])
.simultaneousWithExternalGesture(scrollGesture)
- .onUpdate((e) => {
- if (e.translationX > 0) {
- translateX.value = e.translationX
- } else {
- translateX.value = e.translationX * RUBBER_BAND_FACTOR
- }
- })
- .onEnd((e) => {
- if (e.translationX > DISMISS_THRESHOLD || e.velocityX > 500) {
- const velocity = Math.max(e.velocityX, 800)
- const remaining = panelWidth - e.translationX
- const duration = Math.min(Math.max((remaining / velocity) * 1000, 120), 300)
- translateX.value = withTiming(panelWidth, { duration })
- progress.value = withTiming(0, { duration }, () => {
- runOnJS(dismiss)()
- })
- } else {
- translateX.value = withSpring(0, { ...SETTLE_SPRING, velocity: e.velocityX })
- }
- })
+ .onBegin(() => drag.begin())
+ .onUpdate((e) => drag.follow(e.translationX))
+ .onEnd((e) => drag.release(e.velocityX))
- const drawerStyle = useAnimatedStyle(
- () => ({
- transform: [
- {
- translateX:
- interpolate(progress.value, [0, 1], [panelWidth, 0], Extrapolation.CLAMP) +
- translateX.value
- }
- ]
- }),
- [progress, translateX, panelWidth]
- )
+ // Web has no worklet plugin; mapper hooks need this explicit dependency list.
+ const drawerStyle = useAnimatedStyle(() => {
+ const travel = bottomDrawerTravel(extent.value, screenWidth)
+ return {
+ opacity: fade.value,
+ transform: [{ translateX: bottomDrawerOffset(progress.value, travel) }]
+ }
+ }, [progress, fade, extent, screenWidth])
const backdropStyle = useAnimatedStyle(() => {
- const dragFade = interpolate(translateX.value, [0, panelWidth], [1, 0], Extrapolation.CLAMP)
- return { opacity: progress.value * dragFade }
- }, [progress, translateX, panelWidth])
+ const travel = bottomDrawerTravel(extent.value, screenWidth)
+ return { opacity: fade.value * bottomDrawerScrim(progress.value, travel, extent.value) }
+ }, [progress, fade, extent, screenWidth])
return (
-
+
diff --git a/mobile/src/components/SetupHookTrustDrawer.tsx b/mobile/src/components/SetupHookTrustDrawer.tsx
index 84887b0850a..042fdfe84c0 100644
--- a/mobile/src/components/SetupHookTrustDrawer.tsx
+++ b/mobile/src/components/SetupHookTrustDrawer.tsx
@@ -76,7 +76,14 @@ export function SetupHookTrustDrawer({
-
+ [
+ styles.trustActionRow,
+ pressed && { backgroundColor: colors.translucentFill }
+ ]}
+ disabled={busy}
+ onPress={onRunOnce}
+ >
{t('components.setupHookTrustDrawer.runHooks', 'Run hooks')}
@@ -85,7 +92,14 @@ export function SetupHookTrustDrawer({
{allowAlwaysTrust ? (
<>
-
+ [
+ styles.trustActionRow,
+ pressed && { backgroundColor: colors.translucentFill }
+ ]}
+ disabled={busy}
+ onPress={onAlwaysTrust}
+ >
{t('components.setupHookTrustDrawer.alwaysTrustAndRun', 'Always trust and run')}
@@ -94,7 +108,14 @@ export function SetupHookTrustDrawer({
>
) : null}
-
+ [
+ styles.trustActionRow,
+ pressed && { backgroundColor: colors.translucentFill }
+ ]}
+ disabled={busy}
+ onPress={onDontRun}
+ >
{t('components.setupHookTrustDrawer.dontRun', "Don't run")}
diff --git a/mobile/src/components/SmartWorkspaceSourceDrawer.tsx b/mobile/src/components/SmartWorkspaceSourceDrawer.tsx
index 8a1eb0ba748..210945a63bb 100644
--- a/mobile/src/components/SmartWorkspaceSourceDrawer.tsx
+++ b/mobile/src/components/SmartWorkspaceSourceDrawer.tsx
@@ -27,7 +27,7 @@ import {
} from '../tasks/smart-source-paste-intent'
import { useSmartWorkspaceSource } from '../tasks/use-smart-workspace-source'
import type { MobileComposerSource } from '../tasks/use-mobile-composer-source'
-import { colors } from '../theme/mobile-theme'
+import { colors, pressedStyle } from '../theme/mobile-theme'
import { useMobileColorScheme } from '../theme/use-mobile-color-scheme'
import { useMobileTranslation } from '../i18n/use-mobile-translation'
import { BottomDrawer } from './BottomDrawer'
@@ -234,11 +234,14 @@ export function SmartWorkspaceSourceDrawer({
)}
-
+ [styles.crossRepoDismiss, pressed && pressedStyle]}
+ onPress={dismissCrossRepoPrompt}
+ >
{t('common.cancel', 'Cancel')}
[styles.crossRepoSwitch, pressed && pressedStyle]}
onPress={() => void handleAcceptCrossRepo()}
>
@@ -319,7 +322,11 @@ export function SmartWorkspaceSourceDrawer({
return (
[
+ styles.chip,
+ selected && styles.chipSelected,
+ pressed && pressedStyle
+ ]}
onPress={() => setMrStateFilter(option.id)}
>
@@ -338,7 +345,11 @@ export function SmartWorkspaceSourceDrawer({
return (
[
+ styles.tab,
+ selected && styles.tabSelected,
+ pressed && pressedStyle
+ ]}
onPress={() => setMode(option.id)}
>
diff --git a/mobile/src/components/SmartWorkspaceSourceField.tsx b/mobile/src/components/SmartWorkspaceSourceField.tsx
index 145a17c5213..cb264a532c4 100644
--- a/mobile/src/components/SmartWorkspaceSourceField.tsx
+++ b/mobile/src/components/SmartWorkspaceSourceField.tsx
@@ -9,7 +9,7 @@ import {
} from 'lucide-react-native'
import type { SmartNameSelection } from '../tasks/mobile-composer-source-types'
import type { MobileComposerSource } from '../tasks/use-mobile-composer-source'
-import { colors, spacing } from '../theme/mobile-theme'
+import { colors, spacing, pressedStyle } from '../theme/mobile-theme'
import { themedStyleSheet } from '../theme/themed-styles'
import { useMobileColorScheme } from '../theme/use-mobile-color-scheme'
import { useMobileTranslation } from '../i18n/use-mobile-translation'
@@ -83,7 +83,7 @@ export function SmartWorkspaceSourceField({
{selection.url ? (
[styles.action, pressed && pressedStyle]}
accessibilityRole="link"
accessibilityLabel={t(
'components.smartWorkspaceSourceField.openSelectedSource',
@@ -100,7 +100,7 @@ export function SmartWorkspaceSourceField({
) : null}
[styles.action, pressed && pressedStyle]}
accessibilityRole="button"
accessibilityLabel={t(
'components.smartWorkspaceSourceField.clearSelectedSource',
diff --git a/mobile/src/components/WorktreeAgentRow.tsx b/mobile/src/components/WorktreeAgentRow.tsx
index 4786844338c..8ee8d24d280 100644
--- a/mobile/src/components/WorktreeAgentRow.tsx
+++ b/mobile/src/components/WorktreeAgentRow.tsx
@@ -3,7 +3,7 @@ import { memo } from 'react'
import { Pressable, Text, View } from 'react-native'
import type { RuntimeWorktreeAgentRow } from '../../../src/shared/runtime-types'
import { withoutNativeChatVisualDirectiveLines } from '../../../src/shared/native-chat/native-chat-visual-directive'
-import { colors, spacing } from '../theme/mobile-theme'
+import { colors, spacing, pressedStyle } from '../theme/mobile-theme'
import { themedStyleSheet } from '../theme/themed-styles'
import { useMobileColorScheme } from '../theme/use-mobile-color-scheme'
import {
@@ -82,6 +82,7 @@ function WorktreeAgentRowComponent({
)
return childRow ? (
pressed && pressedStyle}
disabled={isReadOnly || !onPress}
accessibilityRole="button"
onPress={(event) => {
diff --git a/mobile/src/components/agent-monitoring-indicators.test.ts b/mobile/src/components/agent-monitoring-indicators.test.ts
index 2caa6273669..1015a6e586d 100644
--- a/mobile/src/components/agent-monitoring-indicators.test.ts
+++ b/mobile/src/components/agent-monitoring-indicators.test.ts
@@ -19,14 +19,19 @@ async function mount(element: ReactElement): Promise {
return mounted.renderer
}
-const { animationLoop, animationTiming, setValue } = vi.hoisted(() => ({
+const { animationLoop, animationTiming, setValue, motion } = vi.hoisted(() => ({
animationLoop: vi.fn(() => ({ start: vi.fn(), stop: vi.fn() })),
animationTiming: vi.fn(() => ({})),
- setValue: vi.fn()
+ setValue: vi.fn(),
+ motion: { reduced: false }
}))
vi.mock('lucide-react-native', () => ({ Activity: 'Activity' }))
vi.mock('react-native', () => ({
+ AccessibilityInfo: {
+ isReduceMotionEnabled: () => Promise.resolve(motion.reduced),
+ addEventListener: () => ({ remove: () => {} })
+ },
Animated: {
Value: function Value() {
return { interpolate: vi.fn(() => 'rotation'), setValue }
@@ -48,6 +53,7 @@ describe('mobile monitoring indicators', () => {
animationLoop.mockClear()
animationTiming.mockClear()
setValue.mockClear()
+ motion.reduced = false
})
afterEach(() => {
@@ -103,6 +109,23 @@ describe('mobile monitoring indicators', () => {
}
})
+ it('holds both working rings still and closed under Reduce Motion, like desktop', async () => {
+ motion.reduced = true
+ renderer = await mount(
+ createElement('View', null, [
+ createElement(AgentSpinner, { key: 'spinner', status: 'working' }),
+ createElement(AgentStateDot, { key: 'dot', state: 'working' })
+ ])
+ )
+
+ expect(animationLoop).not.toHaveBeenCalled()
+ const rings = findAllByHostType(renderer.root, 'AnimatedView')
+ expect(rings).toHaveLength(2)
+ for (const ring of rings) {
+ expect(ring.props.style).toContainEqual({ borderTopColor: DESKTOP_WORKING_COLOR })
+ }
+ })
+
it.each([
// A user's Stop is not news: muted, never the fault red a failure draws.
['interrupted', colors.textMuted],
diff --git a/mobile/src/components/bottom-drawer-back-while-hiding.test.tsx b/mobile/src/components/bottom-drawer-back-while-hiding.test.tsx
index 3835b43954d..c26b5c56f43 100644
--- a/mobile/src/components/bottom-drawer-back-while-hiding.test.tsx
+++ b/mobile/src/components/bottom-drawer-back-while-hiding.test.tsx
@@ -42,11 +42,14 @@ vi.mock('react-native-gesture-handler', () => {
}
})
vi.mock('./AutoHeight', () => ({ AutoHeight: ({ children }: { children: unknown }) => children }))
+// The OS motion setting is read through AccessibilityInfo, which the react-native mock leaves out.
+vi.mock('../platform/use-reduced-motion', () => ({ useReducedMotionEnabled: () => false }))
vi.mock('react-native-reanimated', () => {
function isTiming(value: unknown): value is Timing {
return typeof value === 'object' && value !== null && 'to' in value
}
return {
+ useReducedMotion: () => false,
Easing: { bezier: () => (t: number) => t },
default: { View: 'AnimatedView', ScrollView: 'AnimatedScrollView' },
useSharedValue: (initial: number) => {
diff --git a/mobile/src/components/bottom-drawer-constants.ts b/mobile/src/components/bottom-drawer-constants.ts
index 487380d4b68..ebdae9d1b76 100644
--- a/mobile/src/components/bottom-drawer-constants.ts
+++ b/mobile/src/components/bottom-drawer-constants.ts
@@ -1,7 +1,17 @@
-import { Easing } from 'react-native-reanimated'
+import { Easing, useReducedMotion } from 'react-native-reanimated'
+import { useReducedMotionEnabled } from '../platform/use-reduced-motion'
import { SHEET_CURVE, SHEET_HEIGHT_DURATION_MS } from './sheet-motion-values'
export const BOTTOM_DRAWER_EASING = Easing.bezier(...SHEET_CURVE)
export const BOTTOM_DRAWER_SHOW_DURATION_MS = 480
export const BOTTOM_DRAWER_HIDE_DURATION_MS = 300
export const BOTTOM_DRAWER_HEIGHT_DURATION_MS = SHEET_HEIGHT_DURATION_MS
+
+/**
+ * Reduce Motion as soon as it is known: the live accessibility value once read, Reanimated's
+ * launch-time value before that, so a drawer opened on mount never slides under Reduce Motion.
+ */
+export function useDrawerReducedMotion(): boolean {
+ const launchValue = useReducedMotion()
+ return useReducedMotionEnabled() ?? launchValue
+}
diff --git a/mobile/src/components/bottom-drawer-modal-host.test.tsx b/mobile/src/components/bottom-drawer-modal-host.test.tsx
index 534f3571716..0e996b0cdff 100644
--- a/mobile/src/components/bottom-drawer-modal-host.test.tsx
+++ b/mobile/src/components/bottom-drawer-modal-host.test.tsx
@@ -42,7 +42,10 @@ vi.mock('react-native-gesture-handler', () => {
}
})
vi.mock('./AutoHeight', () => ({ AutoHeight: ({ children }: { children: unknown }) => children }))
+// The OS motion setting is read through AccessibilityInfo, which the react-native mock leaves out.
+vi.mock('../platform/use-reduced-motion', () => ({ useReducedMotionEnabled: () => false }))
vi.mock('react-native-reanimated', () => ({
+ useReducedMotion: () => false,
Easing: { bezier: () => (t: number) => t },
default: { View: 'AnimatedView', ScrollView: 'AnimatedScrollView' },
useSharedValue: (initial: number) => ({ value: initial }),
diff --git a/mobile/src/components/bottom-drawer-window-handback.test.ts b/mobile/src/components/bottom-drawer-window-handback.test.ts
index 42fe3b0b799..ed35a99d92a 100644
--- a/mobile/src/components/bottom-drawer-window-handback.test.ts
+++ b/mobile/src/components/bottom-drawer-window-handback.test.ts
@@ -44,6 +44,8 @@ vi.mock('react-native-gesture-handler', () => {
}
})
vi.mock('./AutoHeight', () => ({ AutoHeight: ({ children }: { children: unknown }) => children }))
+// The OS motion setting is read through AccessibilityInfo, which the react-native mock leaves out.
+vi.mock('../platform/use-reduced-motion', () => ({ useReducedMotionEnabled: () => false }))
vi.mock('react-native-reanimated', () => {
function makeShared(key: string, initial: number) {
let value = initial
@@ -60,6 +62,7 @@ vi.mock('react-native-reanimated', () => {
let sharedIndex = 0
return {
Easing: { bezier: () => (t: number) => t },
+ useReducedMotion: () => false,
default: { View: 'AnimatedView', ScrollView: 'AnimatedScrollView' },
useSharedValue: (initial: number) => makeShared(`shared-${sharedIndex++}`, initial),
useAnimatedStyle: () => ({}),
diff --git a/mobile/src/components/drag-reorder-test-harness.test-fixture.tsx b/mobile/src/components/drag-reorder-test-harness.test-fixture.tsx
index ef9b6e6f151..e232b2185bd 100644
--- a/mobile/src/components/drag-reorder-test-harness.test-fixture.tsx
+++ b/mobile/src/components/drag-reorder-test-harness.test-fixture.tsx
@@ -203,6 +203,10 @@ vi.mock('react-native-reanimated', async () => {
return { setActive: probe.frameActive }
},
withSpring: probe.spring,
+ withTiming: (value: number) => value,
+ interpolateColor: (value: number, _input: number[], output: string[]) =>
+ value >= 1 ? output[1] : output[0],
+ Easing: { out: (easing: unknown) => easing, cubic: 'cubic' },
runOnJS:
(fn: (...args: unknown[]) => unknown) =>
(...args: unknown[]) => {
diff --git a/mobile/src/components/mobile-markdown-blocks.tsx b/mobile/src/components/mobile-markdown-blocks.tsx
index ca8068f575e..3b7f226a746 100644
--- a/mobile/src/components/mobile-markdown-blocks.tsx
+++ b/mobile/src/components/mobile-markdown-blocks.tsx
@@ -23,6 +23,7 @@ import { codeFenceClosed, plainText } from './mobile-markdown-tree'
import { MermaidDiagram } from './pr-sidebar/MermaidDiagram'
import { MobileMarkdownCodeBlock } from './MobileMarkdownCodeBlock'
import { translate } from '../i18n/mobile-i18n'
+import { pressedStyle } from '../theme/mobile-theme'
/** Prose base size — passed to MermaidDiagram fallback mono text. */
const MERMAID_BASE = 13
@@ -165,7 +166,7 @@ function renderBlock(
return (
[styles.imageFrame, pressed && pressedStyle]}
onPress={() => openMarkdownHref(only.url, ctx.onOpenFile)}
onLongPress={ctx.rowLongPress}
>
diff --git a/mobile/src/components/mounted-bottom-drawer-keyboard-seam.test.tsx b/mobile/src/components/mounted-bottom-drawer-keyboard-seam.test.tsx
index 2d81db40d79..a12d7d14218 100644
--- a/mobile/src/components/mounted-bottom-drawer-keyboard-seam.test.tsx
+++ b/mobile/src/components/mounted-bottom-drawer-keyboard-seam.test.tsx
@@ -64,7 +64,10 @@ vi.mock('react-native-gesture-handler', () => {
}
})
vi.mock('./AutoHeight', () => ({ AutoHeight: ({ children }: { children: unknown }) => children }))
+// The OS motion setting is read through AccessibilityInfo, which the react-native mock leaves out.
+vi.mock('../platform/use-reduced-motion', () => ({ useReducedMotionEnabled: () => false }))
vi.mock('react-native-reanimated', () => ({
+ useReducedMotion: () => false,
Easing: { bezier: () => (t: number) => t },
default: { View: 'AnimatedView', ScrollView: 'AnimatedScrollView' },
useSharedValue: (initial: number) => {
diff --git a/mobile/src/components/mounted-bottom-drawer-page-keyboard.web.test.tsx b/mobile/src/components/mounted-bottom-drawer-page-keyboard.web.test.tsx
index 426267ae574..357b66cbea6 100644
--- a/mobile/src/components/mounted-bottom-drawer-page-keyboard.web.test.tsx
+++ b/mobile/src/components/mounted-bottom-drawer-page-keyboard.web.test.tsx
@@ -56,9 +56,12 @@ vi.mock('react-native-gesture-handler', () => {
}
})
vi.mock('./AutoHeight', () => ({ AutoHeight: ({ children }: { children: unknown }) => children }))
+// The OS motion setting is read through AccessibilityInfo, which the react-native mock leaves out.
+vi.mock('../platform/use-reduced-motion', () => ({ useReducedMotionEnabled: () => false }))
vi.mock('react-native-reanimated', async () => {
const React = await import('react')
return {
+ useReducedMotion: () => false,
Easing: { bezier: () => (t: number) => t },
default: { View: 'AnimatedView', ScrollView: 'AnimatedScrollView' },
useSharedValue: (initial: number) => React.useRef({ value: initial }).current,
diff --git a/mobile/src/components/mounted-bottom-drawer.tsx b/mobile/src/components/mounted-bottom-drawer.tsx
index b723c66cd26..5dc2c95a299 100644
--- a/mobile/src/components/mounted-bottom-drawer.tsx
+++ b/mobile/src/components/mounted-bottom-drawer.tsx
@@ -1,4 +1,4 @@
-import { type ReactNode, useCallback, useEffect, useRef, useState } from 'react'
+import { type ReactNode, useCallback, useEffect, useMemo, useRef, useState } from 'react'
import {
View,
Pressable,
@@ -9,22 +9,12 @@ import {
Platform
} from 'react-native'
import { GestureDetector, GestureHandlerRootView } from 'react-native-gesture-handler'
-import Animated, {
- useSharedValue,
- useAnimatedStyle,
- withTiming,
- runOnJS
-} from 'react-native-reanimated'
+import Animated, { useSharedValue, useAnimatedStyle, withTiming } from 'react-native-reanimated'
import { useMobileTranslation } from '../i18n/use-mobile-translation'
import { spacing } from '../theme/mobile-theme'
import { useMobileColorScheme } from '../theme/use-mobile-color-scheme'
import { resolveBottomDrawerFillHeight } from './bottom-drawer-fill-height'
import { resolveBottomDrawerKeyboardInset } from './bottom-drawer-keyboard-inset'
-import {
- BOTTOM_DRAWER_EASING,
- BOTTOM_DRAWER_HIDE_DURATION_MS,
- BOTTOM_DRAWER_SHOW_DURATION_MS
-} from './bottom-drawer-constants'
import { AutoHeight } from './AutoHeight'
import {
bottomDrawerOffset,
@@ -41,10 +31,9 @@ import { useWindowSafeAreaInsets } from '../layout/side-safe-area'
import { useBackClaim } from '../navigation/use-back-claim'
import { currentSoftKeyboardHeight, subscribeSoftKeyboard } from '../platform/keyboard-occlusion'
import { hostOs } from '../platform/host-os'
-import { useBottomDrawerDrag } from './use-bottom-drawer-drag'
+import { hideDrawer, showDrawer, useBottomDrawerDrag } from './use-bottom-drawer-drag'
+import { useDrawerReducedMotion } from './bottom-drawer-constants'
-const SHOW_TIMING = { duration: BOTTOM_DRAWER_SHOW_DURATION_MS, easing: BOTTOM_DRAWER_EASING }
-const HIDE_TIMING = { duration: BOTTOM_DRAWER_HIDE_DURATION_MS, easing: BOTTOM_DRAWER_EASING }
// The grabber row above the content: its padding plus the 5 pt bar.
const HANDLE_AREA_HEIGHT = spacing.sm + 5 + spacing.md
@@ -78,6 +67,9 @@ export function MountedBottomDrawer({
useMobileColorScheme()
const t = useMobileTranslation()
const progress = useSharedValue(0)
+ const fade = useSharedValue(0)
+ const reducedMotion = useDrawerReducedMotion()
+ const motion = useMemo(() => ({ progress, fade, reducedMotion }), [progress, fade, reducedMotion])
const keyboardOffset = useSharedValue(0)
const scrollOffsetY = useSharedValue(0)
const scrollRef = useRef(null)
@@ -114,7 +106,7 @@ export function MountedBottomDrawer({
if (!tookWindowBack) {
return
}
- progress.value = withTiming(1, SHOW_TIMING)
+ showDrawer(motion)
// Pages have no native binding to heal, and a remount there paints one empty frame of the sheet.
if (Platform.OS !== 'web') {
setWindowEpoch((epoch) => epoch + 1)
@@ -125,15 +117,11 @@ export function MountedBottomDrawer({
// Both directions run from wherever the sheet is, so a reopen mid-close never jumps.
if (visible) {
scrollOffsetY.value = 0
- progress.value = withTiming(1, SHOW_TIMING)
+ showDrawer(motion)
} else {
Keyboard.dismiss()
setKeyboardInset(0)
- progress.value = withTiming(0, HIDE_TIMING, (finished) => {
- if (finished) {
- runOnJS(onHidden)()
- }
- })
+ hideDrawer(motion, onHidden)
}
}, [onHidden, visible])
@@ -192,12 +180,8 @@ export function MountedBottomDrawer({
return
}
Keyboard.dismiss()
- progress.value = withTiming(0, HIDE_TIMING, (finished) => {
- if (finished) {
- runOnJS(onClose)()
- }
- })
- }, [onClose, progress, visible])
+ hideDrawer(motion, onClose)
+ }, [onClose, motion, visible])
// Top interactive sheet claims native/shell Back so Android closes drawer rather than screen; pinned-under sheet never owns key.
useBackClaim(
@@ -211,7 +195,7 @@ export function MountedBottomDrawer({
useBottomDrawerModalHostBackClaim(visible && interactive ? dismiss : null)
const { scrollHandler, scrollGesture, handlePanGesture, contentPanGesture } = useBottomDrawerDrag(
- { progress, sheetHeight, screenHeight, scrollOffsetY, onDismiss: onClose }
+ { ...motion, sheetHeight, screenHeight, scrollOffsetY, onDismiss: onClose }
)
const drawerStyle = useAnimatedStyle(() => {
@@ -219,14 +203,15 @@ export function MountedBottomDrawer({
const keyboardShift = fillAvailable ? 0 : keyboardOffset.value
const travel = bottomDrawerTravel(sheetHeight.value, screenHeight)
return {
+ opacity: fade.value,
transform: [{ translateY: bottomDrawerOffset(progress.value, travel) - keyboardShift }]
}
- }, [progress, keyboardOffset, screenHeight, fillAvailable, sheetHeight])
+ }, [progress, fade, keyboardOffset, screenHeight, fillAvailable, sheetHeight])
const backdropStyle = useAnimatedStyle(() => {
const travel = bottomDrawerTravel(sheetHeight.value, screenHeight)
- return { opacity: bottomDrawerScrim(progress.value, travel, sheetHeight.value) }
- }, [progress, sheetHeight, screenHeight])
+ return { opacity: fade.value * bottomDrawerScrim(progress.value, travel, sheetHeight.value) }
+ }, [progress, fade, sheetHeight, screenHeight])
// Use full-screen native Modal (own/shared) to escape nested ScrollView clipping; progress drives animationType:none so exit finishes before unmount.
const handle = (
diff --git a/mobile/src/components/pr-sidebar/CommentMarkdown.tsx b/mobile/src/components/pr-sidebar/CommentMarkdown.tsx
index e23a2646063..0317d06299e 100644
--- a/mobile/src/components/pr-sidebar/CommentMarkdown.tsx
+++ b/mobile/src/components/pr-sidebar/CommentMarkdown.tsx
@@ -2,7 +2,7 @@ import { useMemo, useState } from 'react'
import { Pressable, ScrollView, StyleSheet, Text, View } from 'react-native'
import { openExternalLink } from '../../platform/external-link'
import { ChevronDown, ChevronRight } from 'lucide-react-native'
-import { colors, radii, spacing, typography } from '../../theme/mobile-theme'
+import { colors, radii, spacing, typography, pressedStyle } from '../../theme/mobile-theme'
import { themedStyleSheet } from '../../theme/themed-styles'
import { useMobileColorScheme } from '../../theme/use-mobile-color-scheme'
import { MermaidDiagram } from './MermaidDiagram'
@@ -63,7 +63,7 @@ function DetailsBlock({
return (
[styles.detailsSummary, pressed && pressedStyle]}
onPress={() => setOpen((v) => !v)}
accessibilityRole="button"
>
diff --git a/mobile/src/components/pr-sidebar/MermaidDiagram.tsx b/mobile/src/components/pr-sidebar/MermaidDiagram.tsx
index 45bf7c8e4b4..cea411848c9 100644
--- a/mobile/src/components/pr-sidebar/MermaidDiagram.tsx
+++ b/mobile/src/components/pr-sidebar/MermaidDiagram.tsx
@@ -1,7 +1,7 @@
import { memo, useEffect, useId, useMemo, useRef, useState, type ReactNode } from 'react'
import { Pressable, ScrollView, StyleSheet, Text, View } from 'react-native'
import { Maximize2 } from 'lucide-react-native'
-import { colors, radii, spacing, typography } from '../../theme/mobile-theme'
+import { colors, radii, spacing, typography, pressedStyle } from '../../theme/mobile-theme'
import { useMobileColorScheme } from '../../theme/use-mobile-color-scheme'
import { themedStyleSheet } from '../../theme/themed-styles'
import { readableMermaidFlowchartSvg } from '../../../../src/shared/mermaid-flowchart-contrast'
@@ -88,7 +88,12 @@ export const MermaidDiagram = memo(function MermaidDiagram({ source, base }: Mer
return (
setExpanded(true) : undefined}>
{/* The header button is the accessible control; the drawing is a tap shortcut. */}
- setExpanded(true)}>
+ pressed && pressedStyle}
+ accessible={false}
+ disabled={!drawnSvg}
+ onPress={() => setExpanded(true)}
+ >
{expanded && drawnSvg ? (
@@ -125,6 +130,7 @@ function MermaidFrame({ children, onExpand }: { children: ReactNode; onExpand?:
mermaid
{onExpand ? (
pressed && pressedStyle}
onPress={onExpand}
hitSlop={8}
accessibilityRole="button"
diff --git a/mobile/src/components/pr-sidebar/MobileLinkPrForm.tsx b/mobile/src/components/pr-sidebar/MobileLinkPrForm.tsx
index dcacda23304..5ce8054c6f8 100644
--- a/mobile/src/components/pr-sidebar/MobileLinkPrForm.tsx
+++ b/mobile/src/components/pr-sidebar/MobileLinkPrForm.tsx
@@ -1,6 +1,6 @@
import { useCallback, useState } from 'react'
import { ActivityIndicator, Pressable, Text, View } from 'react-native'
-import { colors, radii, spacing, typography } from '../../theme/mobile-theme'
+import { colors, radii, spacing, typography, pressedStyle } from '../../theme/mobile-theme'
import { themedStyleSheet } from '../../theme/themed-styles'
import { useMobileColorScheme } from '../../theme/use-mobile-color-scheme'
import type { RpcClient } from '../../transport/rpc-client'
@@ -66,6 +66,7 @@ export function MobileLinkPrForm({ client, worktreeId, onCancel, onLinked }: Pro
{t('pullRequest.linkPrForm.title', 'Link existing pull request')}
pressed && pressedStyle}
onPress={onCancel}
disabled={submitting}
accessibilityRole="button"
diff --git a/mobile/src/components/pr-sidebar/PRActionsSection.tsx b/mobile/src/components/pr-sidebar/PRActionsSection.tsx
index df3c88595f4..1fe9cb7eb9d 100644
--- a/mobile/src/components/pr-sidebar/PRActionsSection.tsx
+++ b/mobile/src/components/pr-sidebar/PRActionsSection.tsx
@@ -1,7 +1,7 @@
import { useCallback, useState } from 'react'
import { ActivityIndicator, Pressable, Text, View } from 'react-native'
import { GitMerge, Link2Off } from 'lucide-react-native'
-import { colors } from '../../theme/mobile-theme'
+import { colors, pressedStyle } from '../../theme/mobile-theme'
import { useMobileColorScheme } from '../../theme/use-mobile-color-scheme'
import type { GitHubPRMergeMethod, PRInfo } from '../../../../src/shared/github/pull-request-types'
import type { RpcClient } from '../../transport/rpc-client'
@@ -143,10 +143,11 @@ export function PRActionsSection({
{avail.canMerge ? (
[
styles.actionButton,
styles.actionButtonMerge,
- (mergeBusy || !merge.enabled) && styles.actionButtonDisabled
+ (mergeBusy || !merge.enabled) && styles.actionButtonDisabled,
+ pressed && pressedStyle
]}
onPress={() => {
setUnlinkError(null)
@@ -173,6 +174,7 @@ export function PRActionsSection({
{merge.hint}
{/* No mobile surface polls PR state, so a blocked Merge needs its own recheck. */}
pressed && pressedStyle}
onPress={() => onRecheck()}
hitSlop={8}
accessibilityRole="button"
@@ -190,10 +192,11 @@ export function PRActionsSection({
{showMarkReady ? (
[
styles.actionButton,
styles.secondaryButton,
- stateBusy && styles.actionButtonDisabled
+ stateBusy && styles.actionButtonDisabled,
+ pressed && pressedStyle
]}
onPress={() => {
setUnlinkError(null)
@@ -219,7 +222,11 @@ export function PRActionsSection({
{t('pullRequest.prActionsSection.autoMergeLabel', 'Auto-merge when ready')}
[
+ styles.togglePill,
+ autoMerge && styles.togglePillOn,
+ pressed && pressedStyle
+ ]}
onPress={() => {
setUnlinkError(null)
actions.setAutoMerge(!autoMerge, effectiveMethod)
@@ -249,10 +256,11 @@ export function PRActionsSection({
{avail.canClose || avail.canReopen ? (
[
styles.actionButton,
styles.secondaryButton,
- stateBusy && styles.actionButtonDisabled
+ stateBusy && styles.actionButtonDisabled,
+ pressed && pressedStyle
]}
onPress={() => {
setUnlinkError(null)
@@ -284,10 +292,11 @@ export function PRActionsSection({
) : null}
{avail.canUnlink ? (
[
styles.actionButton,
styles.secondaryButton,
- unlinkBusy && styles.actionButtonDisabled
+ unlinkBusy && styles.actionButtonDisabled,
+ pressed && pressedStyle
]}
onPress={() => void unlink()}
disabled={unlinkBusy}
diff --git a/mobile/src/components/pr-sidebar/PRChecksSection.tsx b/mobile/src/components/pr-sidebar/PRChecksSection.tsx
index fc69217a3dc..e5a138189c4 100644
--- a/mobile/src/components/pr-sidebar/PRChecksSection.tsx
+++ b/mobile/src/components/pr-sidebar/PRChecksSection.tsx
@@ -2,7 +2,7 @@ import { useCallback, useEffect, useRef, useState } from 'react'
import { ActivityIndicator, Pressable, Text, View } from 'react-native'
import { openExternalLink } from '../../platform/external-link'
import { ChevronDown, ChevronRight, ExternalLink, RotateCw, Sparkles } from 'lucide-react-native'
-import { colors } from '../../theme/mobile-theme'
+import { colors, pressedStyle } from '../../theme/mobile-theme'
import { useMobileColorScheme } from '../../theme/use-mobile-color-scheme'
import { translate } from '../../i18n/mobile-i18n'
import type { Translate } from '../../i18n/mobile-i18n'
@@ -230,7 +230,7 @@ export function PRChecksSection({
{/* Rerun is offered only when something failed; spinner-in-place while in-flight. */}
{actions && count > 0 ? (
[styles.iconButton, pressed && pressedStyle]}
onPress={() => actions.rerunFailingChecks()}
disabled={rerunBusy}
accessibilityRole="button"
@@ -310,7 +310,10 @@ export function PRChecksSection({
return (
[
+ styles.row,
+ pressed && { backgroundColor: colors.translucentFill }
+ ]}
onPress={() => toggle(check)}
accessibilityRole="button"
accessibilityLabel={t(
@@ -332,7 +335,7 @@ export function PRChecksSection({
{url ? (
[styles.rowTrailing, pressed && pressedStyle]}
onPress={() => openExternalLink(url)}
hitSlop={6}
accessibilityRole="button"
diff --git a/mobile/src/components/pr-sidebar/PRCommentCard.tsx b/mobile/src/components/pr-sidebar/PRCommentCard.tsx
index 1a9698f69c5..16d5d8ad3a2 100644
--- a/mobile/src/components/pr-sidebar/PRCommentCard.tsx
+++ b/mobile/src/components/pr-sidebar/PRCommentCard.tsx
@@ -7,7 +7,7 @@ import type {
GitHubReactionContent,
PRComment
} from '../../../../src/shared/github/comment-types'
-import { colors } from '../../theme/mobile-theme'
+import { colors, pressedStyle } from '../../theme/mobile-theme'
import { useMobileColorScheme } from '../../theme/use-mobile-color-scheme'
import type { Translate } from '../../i18n/mobile-i18n'
import { useMobileTranslation } from '../../i18n/use-mobile-translation'
@@ -186,7 +186,7 @@ export const PRCommentCard = memo(function PRCommentCard({
) : null}
{comment.url ? (
[styles.openButton, pressed && pressedStyle]}
onPress={() => openExternalLink(comment.url)}
hitSlop={8}
accessibilityRole="button"
diff --git a/mobile/src/components/pr-sidebar/PRCommentsSection.tsx b/mobile/src/components/pr-sidebar/PRCommentsSection.tsx
index 4109176be7c..777a3d595d7 100644
--- a/mobile/src/components/pr-sidebar/PRCommentsSection.tsx
+++ b/mobile/src/components/pr-sidebar/PRCommentsSection.tsx
@@ -4,7 +4,7 @@ import { ChevronDown, ChevronRight } from 'lucide-react-native'
import type { PRState } from '../../../../src/shared/github/pull-request-types'
import type { GitHubWorkItemDetails } from '../../../../src/shared/github/work-item-types'
import type { GitHubPrRepoSlug } from '../../session/github-pr-rpc'
-import { colors } from '../../theme/mobile-theme'
+import { colors, pressedStyle } from '../../theme/mobile-theme'
import { useMobileColorScheme } from '../../theme/use-mobile-color-scheme'
import type { Translate } from '../../i18n/mobile-i18n'
import { useMobileTranslation } from '../../i18n/use-mobile-translation'
@@ -186,7 +186,11 @@ export function PRCommentsSection({
return (
[
+ styles.audienceTab,
+ active && styles.audienceTabActive,
+ pressed && pressedStyle
+ ]}
onPress={() => selectFilter(tab.value)}
accessibilityRole="button"
accessibilityState={{ selected: active }}
@@ -220,7 +224,7 @@ export function PRCommentsSection({
))}
{remaining > 0 ? (
[styles.showMore, pressed && pressedStyle]}
onPress={() => setLimit((l) => l + COMMENT_PAGE)}
accessibilityRole="button"
>
@@ -302,7 +306,10 @@ function CommentGroupView({
return (
[
+ styles.resolvedHeader,
+ pressed && { backgroundColor: colors.translucentFill }
+ ]}
onPress={() => setExpanded((v) => !v)}
accessibilityRole="button"
>
diff --git a/mobile/src/components/pr-sidebar/PRReviewersSection.tsx b/mobile/src/components/pr-sidebar/PRReviewersSection.tsx
index c2914063e48..74b7a153102 100644
--- a/mobile/src/components/pr-sidebar/PRReviewersSection.tsx
+++ b/mobile/src/components/pr-sidebar/PRReviewersSection.tsx
@@ -1,7 +1,7 @@
import { useMemo, useState } from 'react'
import { ActivityIndicator, Pressable, Text, View } from 'react-native'
import { UserPlus, X } from 'lucide-react-native'
-import { colors } from '../../theme/mobile-theme'
+import { colors, pressedStyle } from '../../theme/mobile-theme'
import { useMobileColorScheme } from '../../theme/use-mobile-color-scheme'
import type { Translate } from '../../i18n/mobile-i18n'
import { useMobileTranslation } from '../../i18n/use-mobile-translation'
@@ -89,7 +89,7 @@ export function PRReviewersSection({ details, actions, client, worktreeId }: Pro
const addButton = (
[styles.iconButton, pressed && pressedStyle]}
onPress={() => setPickerOpen(true)}
accessibilityRole="button"
accessibilityLabel={t('pullRequest.reviewersSection.addOrRemove', 'Add or remove reviewers')}
@@ -133,7 +133,7 @@ export function PRReviewersSection({ details, actions, client, worktreeId }: Pro
{row.stateLabel}
[styles.rowTrailing, pressed && pressedStyle]}
onPress={() => actions.removeReviewer(row.login)}
disabled={busy}
accessibilityRole="button"
diff --git a/mobile/src/components/pr-sidebar/PRSidebarHeader.tsx b/mobile/src/components/pr-sidebar/PRSidebarHeader.tsx
index 3758dac4ec0..2444382b641 100644
--- a/mobile/src/components/pr-sidebar/PRSidebarHeader.tsx
+++ b/mobile/src/components/pr-sidebar/PRSidebarHeader.tsx
@@ -1,7 +1,7 @@
import { useState } from 'react'
import { ActivityIndicator, Pressable, Text, View } from 'react-native'
import { ArrowRight, ExternalLink, Pencil } from 'lucide-react-native'
-import { colors } from '../../theme/mobile-theme'
+import { colors, pressedStyle } from '../../theme/mobile-theme'
import { useMobileColorScheme } from '../../theme/use-mobile-color-scheme'
import { useMobileTranslation } from '../../i18n/use-mobile-translation'
import type { PRInfo } from '../../../../src/shared/github/pull-request-types'
@@ -191,7 +191,7 @@ function PRTitle({
return (
[styles.titleRow, pressed && pressedStyle]}
onPress={editable ? startEdit : undefined}
disabled={!editable}
accessibilityRole={editable ? 'button' : undefined}
diff --git a/mobile/src/components/pr-sidebar/PrSidebarCreateEmptyState.tsx b/mobile/src/components/pr-sidebar/PrSidebarCreateEmptyState.tsx
index 4090ef7c781..28af6a53ad3 100644
--- a/mobile/src/components/pr-sidebar/PrSidebarCreateEmptyState.tsx
+++ b/mobile/src/components/pr-sidebar/PrSidebarCreateEmptyState.tsx
@@ -1,7 +1,7 @@
import { useEffect, useState } from 'react'
import { ActivityIndicator, Pressable, Text, View } from 'react-native'
import { GitPullRequestArrow, Link2, RefreshCw } from 'lucide-react-native'
-import { colors } from '../../theme/mobile-theme'
+import { colors, pressedStyle } from '../../theme/mobile-theme'
import { useMobileColorScheme } from '../../theme/use-mobile-color-scheme'
import { useMobileTranslation } from '../../i18n/use-mobile-translation'
import type { RpcClient } from '../../transport/rpc-client'
@@ -194,7 +194,11 @@ export function PrSidebarCreateEmptyState({
[
+ styles.createButton,
+ (!canCreate || loading) && styles.createButtonDisabled,
+ pressed && pressedStyle
+ ]}
onPress={() => void openComposer()}
disabled={!canCreate || loading}
accessibilityRole="button"
diff --git a/mobile/src/components/pr-sidebar/ReviewerPickerDrawer.tsx b/mobile/src/components/pr-sidebar/ReviewerPickerDrawer.tsx
index b42ba830b4c..cbcb04276ac 100644
--- a/mobile/src/components/pr-sidebar/ReviewerPickerDrawer.tsx
+++ b/mobile/src/components/pr-sidebar/ReviewerPickerDrawer.tsx
@@ -128,7 +128,10 @@ export function ReviewerPickerDrawer({
return (
[
+ styles.pickerRow,
+ pressed && { backgroundColor: colors.translucentFill }
+ ]}
onPress={() => onToggle(item.login)}
accessibilityRole="button"
accessibilityState={{ selected: requested }}
diff --git a/mobile/src/components/right-drawer-hardware-back.test.tsx b/mobile/src/components/right-drawer-hardware-back.test.tsx
index 4df3c803b9d..f4252be2e71 100644
--- a/mobile/src/components/right-drawer-hardware-back.test.tsx
+++ b/mobile/src/components/right-drawer-hardware-back.test.tsx
@@ -36,7 +36,13 @@ vi.mock('react-native-safe-area-context', () => ({
}))
vi.mock('react-native-gesture-handler', () => {
const chain: Record = {}
- for (const method of ['activeOffsetX', 'simultaneousWithExternalGesture', 'onUpdate', 'onEnd']) {
+ for (const method of [
+ 'activeOffsetX',
+ 'simultaneousWithExternalGesture',
+ 'onBegin',
+ 'onUpdate',
+ 'onEnd'
+ ]) {
chain[method] = () => chain
}
return {
@@ -45,7 +51,11 @@ vi.mock('react-native-gesture-handler', () => {
GestureHandlerRootView: 'GestureHandlerRootView'
}
})
+// The OS motion setting is read through AccessibilityInfo, which the react-native mock leaves out.
+vi.mock('../platform/use-reduced-motion', () => ({ useReducedMotionEnabled: () => false }))
vi.mock('react-native-reanimated', () => ({
+ useReducedMotion: () => false,
+ Easing: { bezier: () => (t: number) => t },
default: { View: 'AnimatedView', ScrollView: 'AnimatedScrollView' },
useSharedValue: (initial: number) => ({ value: initial }),
useAnimatedStyle: () => ({}),
diff --git a/mobile/src/components/sheet-motion-values.ts b/mobile/src/components/sheet-motion-values.ts
index 73c0603a278..84a743eda3b 100644
--- a/mobile/src/components/sheet-motion-values.ts
+++ b/mobile/src/components/sheet-motion-values.ts
@@ -10,3 +10,9 @@ export const SHEET_HEIGHT_DURATION_MS = 320
* mass to 4, which turned the old `{ damping, stiffness }` pair into a wobble.
*/
export const SETTLE_SPRING = { dampingRatio: 1, duration: 350 } as const
+/**
+ * Reduce Motion swaps every slide (sheets, the side panel, page pushes, in-sheet pages) for a
+ * cross-fade in place, like iOS; a swipe-away still follows the finger and then fades.
+ */
+export const REDUCED_MOTION_FADE_MS = 200
+export const REDUCED_MOTION_DISMISS_FADE_MS = 150
diff --git a/mobile/src/components/use-bottom-drawer-drag.test.ts b/mobile/src/components/use-bottom-drawer-drag.test.ts
new file mode 100644
index 00000000000..14e353855b5
--- /dev/null
+++ b/mobile/src/components/use-bottom-drawer-drag.test.ts
@@ -0,0 +1,45 @@
+import { describe, expect, it, vi } from 'vitest'
+
+const timings = vi.hoisted((): { to: number; config: Record }[] => [])
+
+vi.mock('react-native-gesture-handler', () => ({ Gesture: {} }))
+vi.mock('react-native-reanimated', () => ({
+ Easing: { bezier: () => (t: number) => t },
+ ReduceMotion: { Never: 'never' },
+ runOnJS: (fn: () => void) => fn,
+ withTiming: (to: number, config: Record, done?: (finished: boolean) => void) => {
+ timings.push({ to, config })
+ done?.(true)
+ return to
+ }
+}))
+vi.mock('../platform/use-reduced-motion', () => ({ useReducedMotionEnabled: () => false }))
+
+import { hideDrawer, showDrawer } from './use-bottom-drawer-drag'
+
+const drawer = (reducedMotion: boolean) => ({
+ progress: { value: 0 },
+ fade: { value: 0 },
+ reducedMotion
+})
+
+describe('drawer motion under Reduce Motion', () => {
+ it('opens in place with a 200 ms fade that Reduce Motion cannot skip', () => {
+ timings.length = 0
+ const motion = drawer(true)
+ showDrawer(motion)
+ expect(motion.progress.value).toBe(1)
+ expect(timings).toEqual([{ to: 1, config: { duration: 200, reduceMotion: 'never' } }])
+ })
+
+ it('closes with the same fade and reports the drawer gone', () => {
+ timings.length = 0
+ const motion = drawer(true)
+ motion.progress.value = 1
+ const onDone = vi.fn()
+ hideDrawer(motion, onDone)
+ expect(motion.progress.value).toBe(1)
+ expect(timings[0]).toMatchObject({ to: 0, config: { duration: 200 } })
+ expect(onDone).toHaveBeenCalledOnce()
+ })
+})
diff --git a/mobile/src/components/use-bottom-drawer-drag.ts b/mobile/src/components/use-bottom-drawer-drag.ts
index 615a25968e8..643042804f9 100644
--- a/mobile/src/components/use-bottom-drawer-drag.ts
+++ b/mobile/src/components/use-bottom-drawer-drag.ts
@@ -1,6 +1,7 @@
import { Gesture } from 'react-native-gesture-handler'
import {
Easing,
+ ReduceMotion,
cancelAnimation,
runOnJS,
useAnimatedScrollHandler,
@@ -9,8 +10,16 @@ import {
withTiming,
type SharedValue
} from 'react-native-reanimated'
-import { BOTTOM_DRAWER_HIDE_DURATION_MS } from './bottom-drawer-constants'
-import { SETTLE_SPRING } from './sheet-motion-values'
+import {
+ BOTTOM_DRAWER_EASING,
+ BOTTOM_DRAWER_HIDE_DURATION_MS,
+ BOTTOM_DRAWER_SHOW_DURATION_MS
+} from './bottom-drawer-constants'
+import {
+ REDUCED_MOTION_DISMISS_FADE_MS,
+ REDUCED_MOTION_FADE_MS,
+ SETTLE_SPRING
+} from './sheet-motion-values'
import {
bottomDrawerDismissMotion,
bottomDrawerDragProgress,
@@ -21,56 +30,131 @@ import {
const TOP_SCROLL_EPSILON = 1
-/**
- * The sheet's drag: the finger moves the same progress value that opens and closes it, so a grab
- * mid-open or mid-close takes the sheet where it is, and release carries the finger's speed.
- */
-export function useBottomDrawerDrag(args: {
+/** The drawer's motion state: `progress` is its position (1 open), `fade` its opacity. */
+export type DrawerMotion = {
progress: SharedValue
- sheetHeight: SharedValue
- screenHeight: number
- scrollOffsetY: SharedValue
- onDismiss: () => void
-}) {
- const { progress, sheetHeight, screenHeight, scrollOffsetY, onDismiss } = args
+ fade: SharedValue
+ reducedMotion: boolean
+}
+
+/** What opening and closing touch: the two values, read and written whole. */
+type DrawerValues = {
+ progress: { value: number }
+ fade: { value: number }
+ reducedMotion: boolean
+}
+
+function fadeTo(fade: { value: number }, to: number, duration: number, onDone?: () => void) {
+ 'worklet'
+ // Never: this fade is what replaces the slide under Reduce Motion, so it must not be skipped too.
+ fade.value = withTiming(to, { duration, reduceMotion: ReduceMotion.Never }, (finished) => {
+ if (finished && onDone) {
+ runOnJS(onDone)()
+ }
+ })
+}
+
+/** Opens from wherever the drawer is: a slide, or a fade in place under Reduce Motion. */
+export function showDrawer({ progress, fade, reducedMotion }: DrawerValues): void {
+ 'worklet'
+ if (reducedMotion) {
+ progress.value = 1
+ fadeTo(fade, 1, REDUCED_MOTION_FADE_MS)
+ return
+ }
+ fade.value = 1
+ progress.value = withTiming(1, {
+ duration: BOTTOM_DRAWER_SHOW_DURATION_MS,
+ easing: BOTTOM_DRAWER_EASING
+ })
+}
+
+/** Closes from wherever the drawer is, then reports it gone. */
+export function hideDrawer(
+ { progress, fade, reducedMotion }: DrawerValues,
+ onDone: () => void
+): void {
+ 'worklet'
+ if (reducedMotion) {
+ fadeTo(fade, 0, REDUCED_MOTION_FADE_MS, onDone)
+ return
+ }
+ progress.value = withTiming(
+ 0,
+ { duration: BOTTOM_DRAWER_HIDE_DURATION_MS, easing: BOTTOM_DRAWER_EASING },
+ (finished) => {
+ if (finished) {
+ runOnJS(onDone)()
+ }
+ }
+ )
+}
+
+/**
+ * A drawer's drag along one axis: the finger moves the same progress value that opens and closes
+ * it, so a grab mid-open or mid-close takes it where it is, and release carries the finger's speed.
+ * `extent` is the drawer's size along the axis and `screenExtent` the screen's.
+ */
+export function useDrawerDrag(
+ args: DrawerMotion & {
+ extent: SharedValue
+ screenExtent: number
+ onDismiss: () => void
+ }
+) {
+ const { progress, extent, screenExtent, reducedMotion, onDismiss } = args
const dragging = useSharedValue(false)
const dragStartOffset = useSharedValue(0)
- const follow = (translationY: number) => {
+ const begin = () => {
'worklet'
- const travel = bottomDrawerTravel(sheetHeight.value, screenHeight)
- if (!dragging.value) {
- cancelAnimation(progress)
- dragStartOffset.value = bottomDrawerOffset(progress.value, travel) - translationY
- dragging.value = true
- }
- progress.value = bottomDrawerDragProgress(dragStartOffset.value + translationY, travel)
+ dragging.value = false
}
- const settle = (velocityY: number) => {
+ const follow = (translation: number) => {
'worklet'
- const travel = bottomDrawerTravel(sheetHeight.value, screenHeight)
+ const travel = bottomDrawerTravel(extent.value, screenExtent)
+ if (!dragging.value) {
+ cancelAnimation(progress)
+ dragStartOffset.value = bottomDrawerOffset(progress.value, travel) - translation
+ dragging.value = true
+ }
+ progress.value = bottomDrawerDragProgress(dragStartOffset.value + translation, travel)
+ }
+
+ const settle = (velocity: number) => {
+ 'worklet'
+ dragging.value = false
+ if (reducedMotion) {
+ progress.value = 1
+ return
+ }
+ const travel = bottomDrawerTravel(extent.value, screenExtent)
progress.value = withSpring(1, {
...SETTLE_SPRING,
- velocity: travel > 0 ? -velocityY / travel : 0
+ velocity: travel > 0 ? -velocity / travel : 0
})
}
- const release = (velocityY: number) => {
+ const release = (velocity: number) => {
'worklet'
if (!dragging.value) {
return
}
dragging.value = false
- const travel = bottomDrawerTravel(sheetHeight.value, screenHeight)
+ const travel = bottomDrawerTravel(extent.value, screenExtent)
const offset = bottomDrawerOffset(progress.value, travel)
- if (!shouldDismissBottomDrawer(offset, velocityY, sheetHeight.value)) {
- settle(velocityY)
+ if (!shouldDismissBottomDrawer(offset, velocity, extent.value)) {
+ settle(velocity)
+ return
+ }
+ if (reducedMotion) {
+ fadeTo(args.fade, 0, REDUCED_MOTION_DISMISS_FADE_MS, onDismiss)
return
}
const motion = bottomDrawerDismissMotion(
offset,
- velocityY,
+ velocity,
travel,
BOTTOM_DRAWER_HIDE_DURATION_MS
)
@@ -85,6 +169,25 @@ export function useBottomDrawerDrag(args: {
)
}
+ return { begin, follow, settle, release, dragging }
+}
+
+/** The bottom sheet's grabber and content drags, over its scrollable content. */
+export function useBottomDrawerDrag(
+ args: DrawerMotion & {
+ sheetHeight: SharedValue
+ screenHeight: number
+ scrollOffsetY: SharedValue
+ onDismiss: () => void
+ }
+) {
+ const { scrollOffsetY } = args
+ const drag = useDrawerDrag({
+ ...args,
+ extent: args.sheetHeight,
+ screenExtent: args.screenHeight
+ })
+
const scrollHandler = useAnimatedScrollHandler((event) => {
scrollOffsetY.value = Math.max(event.contentOffset.y, 0)
})
@@ -93,29 +196,24 @@ export function useBottomDrawerDrag(args: {
const handlePanGesture = Gesture.Pan()
.activeOffsetY([-8, 8])
.simultaneousWithExternalGesture(scrollGesture)
- .onBegin(() => {
- dragging.value = false
- })
- .onUpdate((e) => follow(e.translationY))
- .onEnd((e) => release(e.velocityY))
+ .onBegin(() => drag.begin())
+ .onUpdate((e) => drag.follow(e.translationY))
+ .onEnd((e) => drag.release(e.velocityY))
const contentPanGesture = Gesture.Pan()
.activeOffsetY([-8, 8])
.simultaneousWithExternalGesture(scrollGesture)
- .onBegin(() => {
- dragging.value = false
- })
+ .onBegin(() => drag.begin())
.onUpdate((e) => {
// Tall content scrolls back to its top before a downward drag takes the sheet.
if (scrollOffsetY.value > TOP_SCROLL_EPSILON) {
- if (dragging.value) {
- dragging.value = false
- settle(0)
+ if (drag.dragging.value) {
+ drag.settle(0)
}
return
}
- follow(e.translationY)
+ drag.follow(e.translationY)
})
- .onEnd((e) => release(e.velocityY))
+ .onEnd((e) => drag.release(e.velocityY))
return { scrollHandler, scrollGesture, handlePanGesture, contentPanGesture }
}
diff --git a/mobile/src/components/use-working-motion.ts b/mobile/src/components/use-working-motion.ts
new file mode 100644
index 00000000000..ab80cbf9f8f
--- /dev/null
+++ b/mobile/src/components/use-working-motion.ts
@@ -0,0 +1,56 @@
+import { useEffect, useRef } from 'react'
+import { Animated, Easing } from 'react-native'
+
+// The page runs these as compositor animations instead (use-working-motion.web.ts).
+export type WorkingMotion