@@ -7,15 +7,15 @@ import {
77 StackRouter ,
88 StackRouterOptions ,
99} from "@react-navigation/native" ;
10- import { Config , FlowNavigationState , FormState } from "../types/types" ;
10+ import { Config , FlowNavigationState , FlowState } from "../types/types" ;
1111
1212export type FlowRouterOptions = StackRouterOptions ;
1313
1414export type FlowActionHelpers < ParamList extends ParamListBase > = {
1515 goToNextStep ( ) : void ;
1616 goToPreviousStep ( ) : void ;
1717 quitFlow ( ) : void ;
18- setStoreState ( formState : FormState ) : void ;
18+ setStoreState ( flowState : FlowState ) : void ;
1919} & StackActionHelpers < ParamList > ;
2020
2121export type FlowActionType =
@@ -35,16 +35,16 @@ export type FlowActionType =
3535 | {
3636 type : "SET_STORE_STATE" ;
3737 source ?: string ;
38- payload : { formState : Object } ;
38+ payload : { flowState : Object } ;
3939 } ;
4040
4141export const buildFlowRouter =
4242 (
4343 quitFlowHelper : ( ) => void ,
4444 {
4545 config,
46- initialFormState ,
47- } : { config : Config < ParamListBase > ; initialFormState : FormState }
46+ initialFlowState ,
47+ } : { config : Config < ParamListBase > ; initialFlowState : FlowState }
4848 ) =>
4949 (
5050 options : FlowRouterOptions
@@ -65,7 +65,7 @@ export const buildFlowRouter =
6565
6666 const disabledRouteNames = Object . entries ( config )
6767 . filter ( ( [ _ , isRouteNameEnabledCb ] ) => {
68- return ! isRouteNameEnabledCb ( initialFormState ) ;
68+ return ! isRouteNameEnabledCb ( initialFlowState ) ;
6969 } )
7070 . map ( ( [ routeName ] ) => routeName ) ;
7171
@@ -79,7 +79,7 @@ export const buildFlowRouter =
7979 return {
8080 ...router . getInitialState ( params ) ,
8181 availableRoutes,
82- formState : initialFormState ,
82+ flowState : initialFlowState ,
8383 } ;
8484 } ,
8585
@@ -130,14 +130,14 @@ export const buildFlowRouter =
130130 return state ;
131131
132132 case "SET_STORE_STATE" :
133- const newFormState = {
134- ...state . formState ,
135- ...action . payload . formState ,
133+ const newFlowState = {
134+ ...state . flowState ,
135+ ...action . payload . flowState ,
136136 } ;
137137
138138 const disabledRouteNames = Object . entries ( config )
139139 . filter ( ( [ _ , isRouteNameEnabledCb ] ) => {
140- return ! isRouteNameEnabledCb ( newFormState ) ;
140+ return ! isRouteNameEnabledCb ( newFlowState ) ;
141141 } )
142142 . map ( ( [ routeName ] ) => routeName ) ;
143143
@@ -162,9 +162,9 @@ export const buildFlowRouter =
162162
163163 return {
164164 ...state ,
165- formState : {
166- ...state . formState ,
167- ...action . payload . formState ,
165+ flowState : {
166+ ...state . flowState ,
167+ ...action . payload . flowState ,
168168 } ,
169169 index : state . index - builtRemovedRoute . length ,
170170 availableRoutes,
@@ -186,8 +186,8 @@ export const buildFlowRouter =
186186 quitFlow : ( ) => {
187187 return { type : "QUIT_FLOW" } ;
188188 } ,
189- setStoreState : ( formState ) => {
190- return { type : "SET_STORE_STATE" , payload : { formState } } ;
189+ setStoreState : ( flowState ) => {
190+ return { type : "SET_STORE_STATE" , payload : { flowState } } ;
191191 } ,
192192 } ,
193193 } ;
0 commit comments