forked from
jollywhoppers.com/witchsky.app
Bluesky app fork with some witchin' additions 馃挮
1import {View} from 'react-native'
2import {msg} from '@lingui/core/macro'
3import {useLingui} from '@lingui/react'
4import {Trans} from '@lingui/react/macro'
5import {useNavigation} from '@react-navigation/native'
6
7import {type NavigationProp} from '#/lib/routes/types'
8import {atoms as a, useTheme} from '#/alf'
9import {Button, ButtonText} from '#/components/Button'
10import {Text} from '#/components/Typography'
11
12export function ErrorScreen({error}: {error: React.ReactNode}) {
13 const t = useTheme()
14 const navigation = useNavigation<NavigationProp>()
15 const {_} = useLingui()
16 const onPressBack = () => {
17 if (navigation.canGoBack()) {
18 navigation.goBack()
19 } else {
20 navigation.navigate('Home')
21 }
22 }
23
24 return (
25 <View style={[a.px_xl, a.py_md, a.gap_md]}>
26 <Text style={[a.text_4xl, a.font_bold]}>
27 <Trans>Could not load list</Trans>
28 </Text>
29 <Text style={[a.text_md, t.atoms.text_contrast_high, a.leading_snug]}>
30 {error}
31 </Text>
32
33 <View style={[a.flex_row, a.mt_lg]}>
34 <Button
35 label={_(msg`Go back`)}
36 accessibilityHint={_(msg`Returns to previous page`)}
37 onPress={onPressBack}
38 size="small"
39 color="secondary">
40 <ButtonText>
41 <Trans>Go back</Trans>
42 </ButtonText>
43 </Button>
44 </View>
45 </View>
46 )
47}