mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-21 07:32:02 +00:00
close toast on click
This commit is contained in:
parent
aefc79523d
commit
365bd5cbbc
1 changed files with 11 additions and 3 deletions
|
|
@ -19,7 +19,7 @@ const ToastItem = ({ title, message, dataset, onSelect, onClose, ...props }) =>
|
||||||
null;
|
null;
|
||||||
}, [type, props.icon]);
|
}, [type, props.icon]);
|
||||||
const toastOnClick = React.useCallback((event) => {
|
const toastOnClick = React.useCallback((event) => {
|
||||||
if (!event.nativeEvent.selectPrevented && typeof onSelect === 'function') {
|
if (!event.nativeEvent.selectToastPrevented && typeof onSelect === 'function') {
|
||||||
onSelect({
|
onSelect({
|
||||||
type: 'select',
|
type: 'select',
|
||||||
dataset: dataset,
|
dataset: dataset,
|
||||||
|
|
@ -27,9 +27,17 @@ const ToastItem = ({ title, message, dataset, onSelect, onClose, ...props }) =>
|
||||||
nativeEvent: event.nativeEvent
|
nativeEvent: event.nativeEvent
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [dataset, onSelect]);
|
if (!event.nativeEvent.closeToastPrevented && typeof onClose === 'function') {
|
||||||
|
onClose({
|
||||||
|
type: 'close',
|
||||||
|
dataset: dataset,
|
||||||
|
reactEvent: event,
|
||||||
|
nativeEvent: event.nativeEvent
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, [dataset, onSelect, onClose]);
|
||||||
const closeButtonOnClick = React.useCallback((event) => {
|
const closeButtonOnClick = React.useCallback((event) => {
|
||||||
event.nativeEvent.selectPrevented = true;
|
event.nativeEvent.selectToastPrevented = true;
|
||||||
if (typeof onClose === 'function') {
|
if (typeof onClose === 'function') {
|
||||||
onClose({
|
onClose({
|
||||||
type: 'close',
|
type: 'close',
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue