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