question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

feat: Expose `data` in ActionSheet button props

See original GitHub issue

Prequisites

Describe the Feature Request

Currently it is impossible to thread data through chained ActionSheet instances – one has is to resort to mutable state via button handler to simulate missing data property (yes, the property exists, but is only populated when invoking dismiss, which is useless for cases where the user selects an item from the list).

Describe the Use Case

this.action.create({ handler: () => this.mutable = someData, ... }).then(outer => {
  outer.onDidDismiss().then(x => {
    this.action.create({...}).then(inner => {
      const d = this.mutable // only option is mutable state
      inner.onDidDismiss().then(...)
      inner.present()
    })
  })
  outer.present()
})

Describe Preferred Solution

this.action.create({ buttons: [{data: ...}], ... }).then(outer => {
  outer.onDidDismiss().then(x => {
    this.action.create({...}).then(inner => {
      const d = x.data // data threaded through, no instance level props
      inner.onDidDismiss().then(...)
      inner.present()
    })
  })
  outer.present()
})

Describe Alternatives

It was suggested in the forum to hijack the role property as a substitute, which would work if one were only passing strings, but falls apart for any other data type.

Related Code

No response

Additional Information

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
liamdebeasicommented, Aug 9, 2021

Thanks for the issue. This has been resolved via https://github.com/ionic-team/ionic-framework/pull/23744, and this feature will be available in an upcoming release of the Ionic Framework v6 beta.

0reactions
ionitron-bot[bot]commented, Sep 8, 2021

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

feat: Expose `data` in ActionSheet button props · Issue #23700
The alternative solution is to expose data property at the buttons level such that on every onDidDismiss event built-up state can be accessed ......
Read more >
ActionSheet | Apple Developer Documentation
To supply the options, create instances of ActionSheet.Button to distinguish between ordinary options, destructive options, and cancellation of the user's ...
Read more >
Action Sheet Data on Handler Event - Ionic Framework
Has any thought been given to having handler in action sheet passing selected value from handler event to onDidDismiss as a data property?...
Read more >
react-native-router-flux/CHANGELOG.md - UNPKG
108, - Can't pass props to scene from Action.key\(props\). ... 194, - I would like to reload data when go back from Scene...
Read more >
@ui5/webcomponents-react | Yarn - Package Manager
DynamicPageTitle: expose toolbar overflowPopoverRef ref via toolbar props (#3805 ... ActionSheet: expose tabIndex and onFocus of action buttons (#2390 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found