-
Notifications
You must be signed in to change notification settings - Fork 126
Fix the issue where some dialogs cannot be closed when using nested providers #157
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
base: main
Are you sure you want to change the base?
Conversation
|
@supnate Please review this PR if you have time. |
|
Great ! solved my problem. |
|
谢谢,我在开发中也遇到了同样的问题,已解决 |
|
Additionally, if you prefer not to use import { show, DispatchContext } from '@ebay/nice-modal-react'
const dispatch = useContext(DispatchContext)
show(Dialog, { name: 'hello world' }, dispatch)or import { show, reducer, initialState, Provider } from '@ebay/nice-modal-react'
const [modals, dispatch] = useReducer(reducer, initialState)
show(Dialog, { name: 'hello world' }, dispatch)
<Provider modals={modals} dispatch={dispatch}></Provider> |
|
Perhaps we can provide a hook to automatically bind the dispatch. const { show, hide, remove, Provider } = useProvider()Of course, the naming still needs consideration. |
|
I kept the |
|
Any update on this? |
No one handles this |
relate issues
feature
sample
Please refer to the following example.
You can switch the imports to see the effects before and after the fix.
https://codesandbox.io/p/sandbox/nice-modal-sample-l4hj7d?file=%2Fsrc%2FApp.tsx%3A50%2C64
and
I tried to maintain compatibility as much as possible, so I added extra parameters to the
show,hide, andremovemethods to support dispatch definition.