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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sequential use of the same Modal #3
Comments
Is title changed to 'Step 2' ? If so, it should be because the modal is not re-mount, so though default value is updated, the input will not use it again. If you need a new mounted modal, you can resolve it in
Then you should be able to chain it. |
If you don't want to re-mount the modal, you can also reset the form with input in the modal before calling |
Yes, it's showing
|
Now I understand what you meant, but there's a problem. When the user submits, the promise is resolved with the current value inserted, but stays opened |
Consider the following code, this is how I'm doing |
It needs some workaround for such case: https://codesandbox.io/s/nice-modal-sequential-use-of-the-same-modal-forked-qbspg?file=/src/App.js . However, it would be better handle the wizard logic in the dialog, for example, create a WizardDialog to handle next/prev navigations. |
My InputModal is a generic modal used across the entire App, so isn't beneficial to have a wizard system. Your example looks nice, but unfortunately not perfect. One possible solution I thought, was having the EDIT: const modal = useModal(ModalInput)
const onClick = () => {
modal.show({ title: "Step 1" }).then(r => {
console.log(r)
modal.hide().then(() => {
modal.show({ title: "Step 2" }).then(r => {
console.log(r)
modal.hide()
})
})
})
} |
hmm, seems a reasonable case. I will consider adding promise for |
Let me know if you have plans to make the change soon, if not, I can try to do this myself. |
Yes, I plan to do it this week. |
Done, plz look at the example: https://ebay.github.io/nice-modal-react/#promise . |
Use the latest v1.1.0 . |
Wow 馃帀 |
Thanks for the package, looks great 馃挭
I have a question, I'm trying to implement the same Modal to appear twice, one after the other.
When the user submits the first Modal, the second will appear. Sadly, isn't working perfectly
PS: I'm using bootstrap
That alert at the end, is reporting the value from the first Modal, also, the second
defaultValue
never appears, I guess the second Modal never shows.I tried added a
hide()
before theshow()
but couldn't make it work (maybehide()
doesn't return a promise so I can wait for it to hide)How should I make this work? Is this a limitation or can I have a workaround to make it work?
The text was updated successfully, but these errors were encountered: