Skip to content

bug: useIonModal dismiss method does not accept data or role properties #25208

Closed
@sean-perkins

Description

@sean-perkins

Prerequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x
  • Nightly

Current Behavior

The dismiss method from the useIonModal hook does not accept data or role properties. This prevents developers from easily dismissing a modal and passing data back in the didDismiss event.

Expected Behavior

dismiss should accept two parameters, data and role, just as all other implementation patterns do. This information should be forwarded to the inner dismiss call within the implementation:

overlayRef.current && (await overlayRef.current.dismiss(data, role));

Steps to Reproduce

const [present, dismiss] = useIonModal(ModalExample, {});

dismiss(); // does not accept arguments for data and role

Code Reproduction URL

https://stackblitz.com/edit/react-1udk9j?file=main.js

Ionic Info

N/A

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions