diff --git a/react/src/actions/actionCreators.js b/react/src/actions/actionCreators.js index 635788f..fc91713 100644 --- a/react/src/actions/actionCreators.js +++ b/react/src/actions/actionCreators.js @@ -190,13 +190,14 @@ export function toggleSendReceiveCoinFormsState() { } } -export function triggerToaster(display, message, title, _type) { +export function triggerToaster(display, message, title, _type, autoClose = true) { return { type: ADD_TOASTER_MESSAGE, display, message, title, _type, + autoClose } } diff --git a/react/src/components/toaster/toaster-item.js b/react/src/components/toaster/toaster-item.js index 5c41d8d..0014504 100644 --- a/react/src/components/toaster/toaster-item.js +++ b/react/src/components/toaster/toaster-item.js @@ -16,7 +16,8 @@ class ToasterItem extends React.Component { display: false, message: null, type: null, - title: null + title: null, + autoClose: true }; this.dismissToast = this.dismissToast.bind(this); @@ -33,6 +34,7 @@ class ToasterItem extends React.Component { display: props.display, type: props._type, title: props.title, + autoClose: props.autoClose, toastId: props.toastId }); } else { @@ -41,6 +43,7 @@ class ToasterItem extends React.Component { message: null, type: null, title: null, + autoClose: true, toastId: null }); } @@ -52,7 +55,7 @@ class ToasterItem extends React.Component { renderToast() { // ensure that setTimeout is called only once for each toast message - if (!this.timeoutHandler) { + if (this.state.autoClose && !this.timeoutHandler) { this.timeoutHandler = setTimeout(() => { this.dismissToast(this.state.toastId); }, DISPLAY_LENGTH_MILLIS); diff --git a/react/src/components/toaster/toaster.js b/react/src/components/toaster/toaster.js index 4a2c034..08fdcf4 100644 --- a/react/src/components/toaster/toaster.js +++ b/react/src/components/toaster/toaster.js @@ -27,10 +27,6 @@ class Toaster extends React.Component { } } - dismissToast(toastId) { - Store.dispatch(dismissToasterMessage(toastId)); - } - renderToasts() { if (this.state.toasts && this.state.toasts.length) {