Files
orca/mobile/src/components/NativeScreenRecovery.tsx
T
Kelvin Amoaba 6aa71261b9 feat(mobile): press feedback everywhere, smoother motion, and Reduce Motion for sheets (#36885)
* fix(mobile): stop page bounce and input zoom; URL keyboard for new browser tabs

* feat(mobile): smoother motion, press feedback everywhere, reduced motion for sheets

Working rings and the tool-run pulse run as compositor animations on the
page. Sheets, the right panel, the page stack and the pager cross-fade under
Reduce Motion. The right panel shares the sheet's drag physics. The composer
cross-fades Send/Stop/Save and the mic, jump-to-latest and prompt cards ease
in, banners ease their height, and every Pressable shows a pressed state.
Pairing gets a success beat, and the clean state fades in after a commit.
2026-11-01 04:29:28 +00:00

74 lines
2.5 KiB
TypeScript

import { useEffect, useRef } from 'react'
import { Pressable, Text, View } from 'react-native'
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, pressedStyle } from '../theme/mobile-theme'
import { themedStyleSheet } from '../theme/themed-styles'
import { useMobileColorScheme } from '../theme/use-mobile-color-scheme'
export function NativeScreenRecovery({ error, retry }: ErrorBoundaryProps) {
useMobileColorScheme()
const t = useMobileTranslation()
const router = useRouter()
const route = useRef(useSegments().join('/'))
useEffect(() => {
recordNativeRenderError(error, route.current)
}, [error])
return (
<View style={styles.container}>
<Text style={styles.title}>
{t('components.nativeScreenRecovery.title', 'Something went wrong')}
</Text>
<Pressable
accessibilityRole="button"
style={({ pressed }) => [styles.retryButton, pressed && pressedStyle]}
onPress={() => void retry()}
>
<Text style={styles.retryText}>
{t('components.nativeScreenRecovery.tryAgain', 'Try again')}
</Text>
</Pressable>
<Pressable
accessibilityRole="button"
style={({ pressed }) => [styles.homeButton, pressed && pressedStyle]}
onPress={() => {
discardInitialLaunchIntent()
router.replace('/')
}}
>
<Text style={styles.homeText}>{t('components.nativeScreenRecovery.home', 'Home')}</Text>
</Pressable>
</View>
)
}
const styles = themedStyleSheet(() => ({
container: {
flex: 1,
justifyContent: 'center',
backgroundColor: colors.bgBase,
padding: spacing.xl,
gap: spacing.md
},
title: {
color: colors.textPrimary,
fontSize: typography.titleSize,
fontWeight: '600',
textAlign: 'center',
marginBottom: spacing.sm
},
retryButton: {
backgroundColor: colors.surfaceBright,
borderRadius: radii.control,
padding: spacing.md,
alignItems: 'center'
},
retryText: { color: colors.bgBase, fontSize: typography.bodySize, fontWeight: '600' },
homeButton: { padding: spacing.md, alignItems: 'center' },
homeText: { color: colors.textPrimary, fontSize: typography.bodySize }
}))