segmentio / evergreen

🌲 Evergreen React UI Framework by Segment
https://evergreen.segment.com
MIT License
12.39k stars 832 forks source link

Toaster hasCloseButton and onRemove do not function #1317

Closed seth-wat closed 2 years ago

seth-wat commented 3 years ago

1) Setting the option hasCloseButton: false does not prevent the close button from showing up in the UI 2) The onRemove function is not called when the toast is removed from the UI

examples on codesandbox

mshwery commented 3 years ago

The first issue is probably due to using an || instead of ??: https://github.com/segmentio/evergreen/blob/29f9c41ff15527dac0892330b8032ccd585b1412/src/toaster/src/ToastManager.js#L74

The other one is because we don't let you pass onRemove on individual toasts. That's a prop of the Toast component, but it is not in the settings – the docs may have not been very clear on this.

You can see all the types for the settings for toaster[method](message, settings) here: https://github.com/segmentio/evergreen/blob/29f9c41ff15527dac0892330b8032ccd585b1412/index.d.ts#L2612-L2630