react-native-progress-steps icon indicating copy to clipboard operation
react-native-progress-steps copied to clipboard

Restart stepper on submit

Open OsainAbitia opened this issue 6 years ago • 5 comments

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!

OsainAbitia avatar Aug 27 '20 21:08 OsainAbitia

UP!

elielcena avatar Nov 02 '20 18:11 elielcena

<ProgressSteps activeStep={this.state.currentStep}> </ProgressSteps > onSubmit => set currentStep to 0

edwinsmasher avatar Nov 12 '20 02:11 edwinsmasher

<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
            }}
          >

abdodeve avatar Jan 24 '21 00:01 abdodeve

Great!, I'm closing this issue, thanks!

OsainAbitia avatar Feb 05 '21 02:02 OsainAbitia

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>

); }`

BryanTacuri avatar Sep 03 '22 17:09 BryanTacuri