Bluesky app fork with some witchin' additions 馃挮 witchsky.app
bluesky fork client
at main 78 lines 2.3 kB view raw
1import React from 'react' 2import {StyleSheet, View} from 'react-native' 3import {msg} from '@lingui/core/macro' 4import {useLingui} from '@lingui/react' 5import {Trans} from '@lingui/react/macro' 6import { 7 StackActions, 8 useFocusEffect, 9 useNavigation, 10} from '@react-navigation/native' 11 12import {usePalette} from '#/lib/hooks/usePalette' 13import {type NavigationProp} from '#/lib/routes/types' 14import {s} from '#/lib/styles' 15import {useSetMinimalShellMode} from '#/state/shell' 16import {Button} from '#/view/com/util/forms/Button' 17import {Text} from '#/view/com/util/text/Text' 18import {ViewHeader} from '#/view/com/util/ViewHeader' 19import * as Layout from '#/components/Layout' 20 21export const NotFoundScreen = () => { 22 const pal = usePalette('default') 23 const {_} = useLingui() 24 const navigation = useNavigation<NavigationProp>() 25 const setMinimalShellMode = useSetMinimalShellMode() 26 27 useFocusEffect( 28 React.useCallback(() => { 29 setMinimalShellMode(false) 30 }, [setMinimalShellMode]), 31 ) 32 33 const canGoBack = navigation.canGoBack() 34 const onPressHome = React.useCallback(() => { 35 if (canGoBack) { 36 navigation.goBack() 37 } else { 38 navigation.navigate('HomeTab') 39 navigation.dispatch(StackActions.popToTop()) 40 } 41 }, [navigation, canGoBack]) 42 43 return ( 44 <Layout.Screen testID="notFoundView"> 45 <ViewHeader title={_(msg`Page Not Found`)} /> 46 <View style={styles.container}> 47 <Text type="title-2xl" style={[pal.text, s.mb10]}> 48 <Trans>Page not found</Trans> 49 </Text> 50 <Text type="md" style={[pal.text, s.mb10]}> 51 <Trans> 52 We're sorry! We can't find the page you were looking for. 53 </Trans> 54 </Text> 55 <Button 56 type="primary" 57 label={canGoBack ? _(msg`Go Back`) : _(msg`Go Home`)} 58 accessibilityLabel={canGoBack ? _(msg`Go back`) : _(msg`Go home`)} 59 accessibilityHint={ 60 canGoBack 61 ? _(msg`Returns to previous page`) 62 : _(msg`Returns to home page`) 63 } 64 onPress={onPressHome} 65 /> 66 </View> 67 </Layout.Screen> 68 ) 69} 70 71const styles = StyleSheet.create({ 72 container: { 73 paddingTop: 100, 74 paddingHorizontal: 20, 75 alignItems: 'center', 76 height: '100%', 77 }, 78})