How to use the react-toastify.toast.isActive function in react-toastify

To help you get started, we’ve selected a few react-toastify examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TheThingsNetwork / lorawan-stack / pkg / webui / components / toast / toast.js View on Github external
const next = function() {
    const hasNext = queue.length > 0

    if (!hasNext) {
      firstDispatched = false
    } else if (hasNext && !t.isActive(toastId)) {
      show(queue.shift())
    }
  }
github fkhadra / react-toastify / src / BasicExample / PreventDuplicate.js View on Github external
notify = () => {
    if (! toast.isActive(this.toastId)) {
      this.toastId = toast("I cannot be duplicated !");
    }
  };
github no-stack-dub-sack / cs-playground-react / src / components / sidebar / ReplsMap.js View on Github external
notifyDuplicate = () => {
    if (!toast.isActive(this.toastId)) {
      this.toastId = toast.error(
        `There is already a repl or challenge with the name ${this.state.value}`
      )
    }
  }
  handleAddRepl = (e) => {
github ailabstw / pttai.js / src / containers / RootPage.js View on Github external
let onConnectionLost = (message) => {
      if (!toast.isActive(this.toastId)) {
        this.toastId = toast.error(message, { autoClose: 3000 })
      }
    }
github drud / ddev-ui / src / renderer / components / Dashboard.jsx View on Github external
this.setState(prevState => {
        const { errors } = prevState;
        const nonDockerErrors = _.find(errors, e => e.id !== 'docker');
        if (toast.isActive('docker')) {
          toast.dismiss('docker');
        }
        if (_.isUndefined(nonDockerErrors)) {
          return { errors: {} };
        }
        return { errors: nonDockerErrors };
      });
    }
github no-stack-dub-sack / cs-playground-react / src / components / Controls.js View on Github external
toastShareLink = (shareLink: string): void => {
    if (!toast.isActive(this.toastId)) {
      this.toastId = toast.error(
        `Click to copy share link: ${shareLink}`, {
          autoClose: false,
          onClose: () => this.copyShareLink(shareLink),
        }
      )
    }
  }
  copyShareLink = (shareLink) => {
github plone / volto / src / components / theme / Login / Login.jsx View on Github external
componentWillUnmount() {
    if (toast.isActive('loginFailed')) {
      toast.dismiss('loginFailed');
    }
  }
github rubenspgcavalcante / findabike / app / modules / commons / components / OfflineToast.jsx View on Github external
static _showMessage(offline) {
    const { BOTTOM_RIGHT } = toast.POSITION;
    if (toast.isActive(this.toastId)) {
      return;
    }

    return offline
      ? (this.toastId = toast(message, {
          position: BOTTOM_RIGHT,
          closeButton: false,
          autoClose: false,
          closeOnClick: false,
          className: classNames("toast", { offline })
        }))
      : toast.dismiss();
  }
github bigbluebutton / bigbluebutton / bigbluebutton-html5 / imports / ui / components / toast / service.jsx View on Github external
const notify = (message, type = 'default', icon, options) => {
  const settings = {
    type,
    ...options,
  };

  const { id: lastToastId, ...lastToastProps } = lastToast;
  const toastProps = { message, type, icon };

  if (!toast.isActive(lastToast.id) || !_.isEqual(lastToastProps, toastProps)) {
    const id = toast(, settings);

    lastToast = { id, ...toastProps };
  }
};
github Azure / azure-iot-explorer / src / app / notifications / components / notificationToast.tsx View on Github external
export const raiseNotificationToast = (notification: Notification) => {
    const component = fetchComponent(notification);
    const options: ToastOptions = {
        bodyClassName: 'notification-toast-body',
        closeButton: ,
        position: toast.POSITION.TOP_RIGHT,
        progressClassName: `notification-toast-progress-bar`,
        toastId: notification.id,
        type: ToastType.DEFAULT
    };

    if (notification.id && toast.isActive(notification.id)) {
        const updateOptions = options as UpdateOptions;
        updateOptions.render = component;
        toast.update(notification.id, options);
    }
    else {
        toast(component, options);
    }
};