You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@charlotteisambert thank you for this library, we are trying it out but found some unexpected behaviour.
This example flow consists of 2 steps but the last step is conditionally included and can be toggled from the Step1Page
On Step1Page we first enable Step2 and then directly after check with canGoToNextStep whether there is a next step to navigate to or we should quite the flow.
import { useFlow } from "@bam.tech/flow-navigator";
import { Button, Text, View } from "react-native";
import { useAppContext } from "./flow";
export const Step1Page = () => {
const { goToNextStep, canGoToNextStep, quitFlow } = useFlow();
const { setStep2Enabled, step2Enabled } = useAppContext();
const goNext = async () => {
setStep2Enabled(true);
// canGoToNextStep is not enabled here?
if (canGoToNextStep) {
goToNextStep();
} else {
console.warn(
"Should not happen because we enable step 2 first so we can always go to a next step"
);
quitflow();
}
};
return (
<View>
<Text>Step 2 enabled:{step2Enabled ? "YES" : "NO"}</Text>
<Button title="Enable step 2 and go to next page" onPress={goNext} />
</View>
);
};
We would expect canGoToNextStep in this example to be true because just calling goToNextStep() here actually works. In this case it is a very obvious case where we know within this screen that there should be a next screen so we could also just call goToNextStep() but this might not always be the case. I believe we should always check whether we can go to the next step to not make screens aware of their position. Is there anything we should do differently here to make it work?
The text was updated successfully, but these errors were encountered:
@charlotteisambert thank you for this library, we are trying it out but found some unexpected behaviour.
This example flow consists of 2 steps but the last step is conditionally included and can be toggled from the Step1Page
On Step1Page we first enable Step2 and then directly after check with
canGoToNextStep
whether there is a next step to navigate to or we should quite the flow.Full code example can be found here
We would expect
canGoToNextStep
in this example to be true because just callinggoToNextStep()
here actually works. In this case it is a very obvious case where we know within this screen that there should be a next screen so we could also just callgoToNextStep()
but this might not always be the case. I believe we should always check whether we can go to the next step to not make screens aware of their position. Is there anything we should do differently here to make it work?The text was updated successfully, but these errors were encountered: