Skip to content

Commit

Permalink
[docs] Improve the Modal onClose migration (#27775)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Aug 16, 2021
1 parent 6a2a408 commit d5017f3
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions docs/src/pages/guides/migration-v4/migration-v4.md
Expand Up @@ -1127,15 +1127,15 @@ As the core components use emotion as their style engine, the props used by emot
> ✅ This is handled in [🪄preset-safe codemod](#preset-safe).
```diff
<Dialog
- disableBackdropClick
- onClose={handleClose}
+ onClose={(event, reason) => {
+ if (reason !== 'backdropClick') {
+ onClose(event, reason);
+ }
+ }}
/>
<Dialog
- disableBackdropClick
- onClose={handleClose}
+ onClose={(event, reason) => {
+ if (reason !== 'backdropClick') {
+ handleClose(event, reason);
+ }
+ }}
/>
```

- Remove the `withMobileDialog` higher-order component. The hook API allows a simpler and more flexible solution:
Expand Down Expand Up @@ -1517,7 +1517,7 @@ As the core components use emotion as their style engine, the props used by emot
- onClose={handleClose}
+ onClose={(event, reason) => {
+ if (reason !== 'backdropClick') {
+ onClose(event, reason);
+ handleClose(event, reason);
+ }
+ }}
/>
Expand Down

0 comments on commit d5017f3

Please sign in to comment.