Restart stepper on submit
Hi! I'm trying to restart stepper when the user press the submit button in final step, I've tried updating the currentStep with useState but isn't rendering. Am I missing something?
Thanks in advance!
UP!
<ProgressSteps activeStep={this.state.currentStep}>
</ProgressSteps >
onSubmit => set currentStep to 0
<ProgressSteps activeStep={this.state.currentStep}> </ProgressSteps >onSubmit => set currentStep to 0
Thank you @edwinsmasher that's work for me
I added this
const [currentStep, setCurrentStep] = useState(0);
<ProgressSteps
marginBottom={0}
topOffset={10}
progressBarColor="#ecf0f1"
disabledStepIconColor="#ecf0f1"
activeStepIconBorderColor="#2ecc71"
completedStepIconColor="#2ecc71"
completedProgressBarColor="#2ecc71"
activeStep={currentStep} <------------------ This line
>
And at the last step
<ProgressStep
{...ProgressStepPropsPrevious}
{...ProgressStepPropsSubmit}
onSubmit={() => {
// Reset
setCurrentStep(0); <---------- this line
}}
>
Great!, I'm closing this issue, thanks!
Hello, I have the same problem but @abdodeve comment doesn't work for me :(. Could you help me? I attach my code: const [currentStep, setCurrentStep] = useState(0);
`return (
<View >
<ProgressSteps activeStep={currentStep}>
<ProgressStep>
<Text>Step 1</Text>
</ProgressStep>
<ProgressStep>
<View >
<Text>
VENTANA PAGO
</Text>
</View>
</ProgressStep>
<ProgressStep onSubmit={() => setCurrentStep(0)}>
<View>
<Text>
Suscripción generada exitosamente
</Text>
</View>
</ProgressStep>
</ProgressSteps>
</View>
); }`