Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed next button disabled issue when navigating to prev step #19

Merged
merged 2 commits into from
Mar 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/twelve-grapes-sort.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'formik-wizard-form': patch
---

Fixed next button disabled issue when navigating to previous step
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"lint:staged": "lint-staged",
"lint:commit": "commitlint",
"commit": "git-cz",
"format": "prettier --write 'src/**/*' 'website/**/*.{ts,tsx,js,jsx,md,mdx}'",
"format": "prettier --write \"src/**/*\" \"website/**/*.{ts,tsx,js,jsx,md,mdx}\"",
"cypress": "cypress run",
"cypress:open": "cypress open",
"size": "size-limit",
Expand Down Expand Up @@ -108,8 +108,7 @@
},
"lint-staged": {
"**/*.{ts,tsx,md,mdx,js,jsx}": [
"npm run format",
"npm run lint"
"npm run format"
]
},
"jest": {
Expand Down
5 changes: 4 additions & 1 deletion src/FormkWizard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ const FormikWizard = ({
{typeof children === 'function'
? formikBag => {
const wizardProps = {
handlePrev: handlePrev(formikBag),
handlePrev: async () => {
await handlePrev(formikBag)();
await formikBag.validateForm();
},
handleNext: handleNext(formikBag),
isFirstStep,
isLastStep,
Expand Down
5 changes: 4 additions & 1 deletion src/useFormikWizard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ const useFormikWizard = ({

return {
...formik,
handlePrev: handlePrev(formik),
handlePrev: async () => {
await handlePrev(formik)();
await formik.validateForm();
},
handleNext: handleNext(formik),
isFirstStep,
isLastStep,
Expand Down