ionic-team / ionic-team/ionic-framework

bug: toast, cannot render only button and have container fit width

未关闭
#25,657 7 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
package: core type: bug
主要语言
TypeScript
星标
52.7k
派生
13.3k
平均合并
1 天 15 小时
30 天内合并 PR
51

描述

### Prerequisites

- [X] I have read the [Contributing Guidelines](https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#creating-an-issue).
- [X] I agree to follow the [Code of Conduct](https://ionicframework.com/code-of-conduct).
- [X] I have searched for [existing issues](https://github.com/ionic-team/ionic-framework/issues) that already include this feature request, without success.

### Describe the Feature Request

i really like the Toast Component, but in 99% of my apps i ending up implementing my own toast's, which has mostly two reasons:

- Swipeable feature (there exists a PR for that since a long time: #23124)
- Click handler on the toast itself - not a specific button

The second one is the one i want to target in here 😊

### Describe the Use Case

It would be great beeing able to add a click handler to the whole toast. Two things i would use this for:

- "Undo" toast after an action
- In most apps i fetch push notifications when you are in app and present them via a toast - like instagram does.

For both cases the click handler would help a lot, as an extra button is not very nice here.

### Describe Preferred Solution

This should work similar to the handler of e.g. an alert button: Called on click and you **can** return a `boolean | Promise` that says if you should dismiss or don't dismiss the toast

### Describe Alternatives

_No response_

### Related Code

_No response_

### Additional Information

_No response_

贡献指南

打开贡献指南

调研方向

Start by reviewing the Toast Component and its existing button-handler behavior; the issue compares the desired callback with alert button handlers and references swipe support in PR #23124. Done means the whole toast can invoke a click handler and use its boolean or Promise result to determine whether the toast dismisses.

由索引模型根据 Issue 内容生成。

评估

技术栈
typescript
领域
frontend
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。