Skip to content

Suggestions for refactoring Toast component #315

Closed
@unix

Description

Feature request 🚀

  • I will create Pull Request
  • It's just a suggestion

Expected

  • Add placement prop to Toast
  • The height of Toast is no longer restricted
  • Render other components within Toast
  • Remove animation

Examples

Now the Toast component can only render strings, if we remove some restrictions, we can let Toast render more components, even more functions can be customized.

setToast({ render: () => <Text b>text</Text> })

Programme (Optional)

Now the animation effect can not get the same performance in different positions, like material-ui, I plan to remove some unnecessary animation and add more functionality to the components.

You can see my discussion about animation in #306 . Now I have a proposal to remove animation and add more features, here's the reason to remove animation:

  • Toast can be displayed in four corners of the page.
  • Faster removal of DOM (regardless of the integrity of the animation, I don't have to keep the elements in the dom).
  • If DOM can be removed synchronously, I think Toast can support rendering more other components. (no pref concerns)

I hope to make some changes on the Toast component to make our components more practical. (now Toast's function seems a little crude)

Polls:


Others

Related issues: #306 #312

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions