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

Modal footer action triggers onClose callback #6818

Closed
Kizaruuu opened this issue Jan 16, 2025 · 4 comments
Closed

Modal footer action triggers onClose callback #6818

Kizaruuu opened this issue Jan 16, 2025 · 4 comments
Labels

Comments

@Kizaruuu
Copy link

Version of antd-mobile

5.3.2

Operating system and its version

No response

Browser and its version

No response

Sandbox to reproduce

https://codesandbox.io/p/devbox/qg4ptg

What happened?

The documentation says onClose is a callback triggered by clicking the close icon (X) or the mask, but it is being triggered by footer actions

Relevant log output

@Kizaruuu Kizaruuu added the bug label Jan 16, 2025
@Layouwen
Copy link
Member

Layouwen commented Jan 16, 2025

onClose is for operations after closing, including closing by any means.

@Kizaruuu
Copy link
Author

onClose is for operations after closing, including closing by any means.

I want a callback triggered by clicking the mask. Is there any way to achieve this? For example, I have a variable: when I open the modal and edit it, clicking the mask should roll back the changes, while clicking a footer action should save them

@Layouwen
Copy link
Member

onClose is for operations after closing, including closing by any means.

I want a callback triggered by clicking the mask. Is there any way to achieve this? For example, I have a variable: when I open the modal and edit it, clicking the mask should roll back the changes, while clicking a footer action should save them

Oh ~ Understand the need. However, the icon callback function may not be supported yet. You may need to temporarily showCloseButton={false} Then draw their own in a close icon, to listen to his click.

@Kizaruuu
Copy link
Author

Oh ~ Understand the need. However, the icon callback function may not be supported yet. You may need to temporarily showCloseButton={false} Then draw their own in a close icon, to listen to his click.

Got it. Thanks for the support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants