Bluesky app fork with some witchin' additions 馃挮 witchsky.app
bluesky fork client
at main 74 lines 2.4 kB view raw
1import {useCallback, useLayoutEffect, useState} from 'react' 2import {LayoutAnimationConfig} from 'react-native-reanimated' 3import {msg} from '@lingui/core/macro' 4import {useLingui} from '@lingui/react' 5import {usePreventRemove} from '@react-navigation/native' 6 7import { 8 type AllNavigatorParams, 9 type NativeStackScreenProps, 10} from '#/lib/routes/types' 11import {useSetMinimalShellMode} from '#/state/shell' 12import {ErrorScreen} from '#/view/com/util/error/ErrorScreen' 13import {FindContactsFlow} from '#/components/contacts/FindContactsFlow' 14import {useFindContactsFlowState} from '#/components/contacts/state' 15import * as Layout from '#/components/Layout' 16import {ScreenTransition} from '#/components/ScreenTransition' 17import {IS_NATIVE} from '#/env' 18 19type Props = NativeStackScreenProps<AllNavigatorParams, 'FindContactsFlow'> 20export function FindContactsFlowScreen({navigation}: Props) { 21 const {_} = useLingui() 22 23 const [state, dispatch] = useFindContactsFlowState() 24 25 const [transitionDirection, setTransitionDirection] = useState< 26 'Forward' | 'Backward' 27 >('Forward') 28 29 const overrideGoBack = state.step === '2: verify number' 30 31 usePreventRemove(overrideGoBack, () => { 32 setTransitionDirection('Backward') 33 dispatch({type: 'BACK'}) 34 setTimeout(() => { 35 setTransitionDirection('Forward') 36 }) 37 }) 38 39 const setMinimalShellMode = useSetMinimalShellMode() 40 const effect = useCallback(() => { 41 setMinimalShellMode(true) 42 return () => setMinimalShellMode(false) 43 }, [setMinimalShellMode]) 44 useLayoutEffect(effect) 45 46 return ( 47 <Layout.Screen> 48 {IS_NATIVE ? ( 49 <LayoutAnimationConfig skipEntering skipExiting> 50 <ScreenTransition key={state.step} direction={transitionDirection}> 51 <FindContactsFlow 52 state={state} 53 dispatch={dispatch} 54 onCancel={() => 55 navigation.canGoBack() 56 ? navigation.goBack() 57 : navigation.navigate('FindContactsFlow', undefined, { 58 pop: true, 59 }) 60 } 61 context="Standalone" 62 /> 63 </ScreenTransition> 64 </LayoutAnimationConfig> 65 ) : ( 66 <ErrorScreen 67 title={_(msg`Not available on this platform.`)} 68 message={_(msg`Please use the native app to sync your contacts.`)} 69 showHeader 70 /> 71 )} 72 </Layout.Screen> 73 ) 74}