diff --git a/packages/example/src/FlowNavigatorExample.tsx b/packages/example/src/FlowNavigatorExample.tsx index 06ae21e..4350f78 100644 --- a/packages/example/src/FlowNavigatorExample.tsx +++ b/packages/example/src/FlowNavigatorExample.tsx @@ -4,11 +4,12 @@ import {useQuery} from '@tanstack/react-query'; import {getHasToPassStep4} from './queries/hasToPassStep4'; import {ActivityIndicator, StyleSheet, View} from 'react-native'; import {Step1Page} from './steps/Step1/Step1Page'; -import {Step2Navigator} from './steps/Step2/Step2Navigator'; import {Step31Page} from './steps/Step3/Step3-1Page'; import {Step32Page} from './steps/Step3/Step3-2Page'; import {Step4Page} from './steps/Step4/Step4Page'; import {Step5Page} from './steps/Step5/Step4Page'; +import {atom, useAtom} from 'jotai'; +import {Step22Page} from './steps/Step2/Step2-2Page'; export type FlowStackParamList = { Step1: undefined; @@ -21,7 +22,11 @@ export type FlowStackParamList = { const FlowNavigator = createFlowNavigator(); +export const show = atom(false); + export const FlowNavigatorExample = () => { + const [isShow, _] = useAtom(show); + const {data: hasToPassStep4, isLoading: isStep4Loading} = useQuery( ['hasToPassStep4'], getHasToPassStep4, @@ -35,22 +40,17 @@ export const FlowNavigatorExample = () => { ); } - const initialDisabledRoutes = [ - 'Step31', - ...(hasToPassStep4 ? [] : ['Step4']), - ]; - return ( - + - + {isShow && } - + {hasToPassStep4 && ( + + )} ); diff --git a/packages/example/src/steps/Step1/Step1Page.tsx b/packages/example/src/steps/Step1/Step1Page.tsx index 464282b..c7868a3 100644 --- a/packages/example/src/steps/Step1/Step1Page.tsx +++ b/packages/example/src/steps/Step1/Step1Page.tsx @@ -3,17 +3,26 @@ import React from 'react'; import {Button, StyleSheet, Text, View} from 'react-native'; import {FlowInfos} from '../FlowInfos'; import {ParamListBase, useNavigation} from '@react-navigation/native'; +import {useAtom} from 'jotai'; +import {show} from '../../FlowNavigatorExample'; export const Step1Page = () => { const {goToNextStep, quitFlow} = useNavigation>(); + const [_, setIsShow] = useAtom(show); return ( Current page: 1