Open Spinnenzunge opened 1 year ago
Thanks for the report. The ActionSheetButton
interface has a data
property that you can use to return data from the handler. Have you tried using that? We have a work in progress component playground that shows how to use this: https://ionic-docs-git-fw-1309-ionic1.vercel.app/docs/api/action-sheet
Hi @liamdebeasi yes I have seen that property, but this is just a static property value of a button element that gets passed trough to the dismiss event.
My use case is processing business logic inside the handler function (maybe async and impure with DI, etc.) as shown in my example. For that I cannot really use a static data attribute but need to be able to return it in the button handler.
Prerequisites
Describe the Feature Request
It would be great if the
handler
function of an overlay button (e.g.IonActionSheetButton
) would allow overlay data as a return value.Describe the Use Case
I have an
IonActionSheet
with three buttons that resolve some data from a promise. When the data is resolved and is not null, the IonActionSheet should dismiss with given data in theOverlayEventDetail
. If the data is null, I do not want to close the ActionSheet by returning false in the handler method.At the moment I can not return data inside the handler value except by using the dismiss method of the created action sheet itself.
Describe Preferred Solution
The
handler()
method on anIonActionSheetButton
should accept OverlayEventDetail object as return valueDescribe Alternatives
No response
Related Code
At the moment I have to solve the problem with using the
dismiss()
method of the action sheet element. But this results in the buttons role attribute being ignored because the dismiss is triggered by thedismiss()
method and not via the handler default.Additional Information
No response