import {useCallback, useLayoutEffect, useState} from 'react' import {LayoutAnimationConfig} from 'react-native-reanimated' import {msg} from '@lingui/core/macro' import {useLingui} from '@lingui/react' import {usePreventRemove} from '@react-navigation/native' import { type AllNavigatorParams, type NativeStackScreenProps, } from '#/lib/routes/types' import {useSetMinimalShellMode} from '#/state/shell' import {ErrorScreen} from '#/view/com/util/error/ErrorScreen' import {FindContactsFlow} from '#/components/contacts/FindContactsFlow' import {useFindContactsFlowState} from '#/components/contacts/state' import * as Layout from '#/components/Layout' import {ScreenTransition} from '#/components/ScreenTransition' import {IS_NATIVE} from '#/env' type Props = NativeStackScreenProps export function FindContactsFlowScreen({navigation}: Props) { const {_} = useLingui() const [state, dispatch] = useFindContactsFlowState() const [transitionDirection, setTransitionDirection] = useState< 'Forward' | 'Backward' >('Forward') const overrideGoBack = state.step === '2: verify number' usePreventRemove(overrideGoBack, () => { setTransitionDirection('Backward') dispatch({type: 'BACK'}) setTimeout(() => { setTransitionDirection('Forward') }) }) const setMinimalShellMode = useSetMinimalShellMode() const effect = useCallback(() => { setMinimalShellMode(true) return () => setMinimalShellMode(false) }, [setMinimalShellMode]) useLayoutEffect(effect) return ( {IS_NATIVE ? ( navigation.canGoBack() ? navigation.goBack() : navigation.navigate('FindContactsFlow', undefined, { pop: true, }) } context="Standalone" /> ) : ( )} ) }