question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: <SHOW_TOAST> Event is not registered.

See original GitHub issue

Edit: Scroll to Actual Error

Hello, I’ve tried my best to follow the directions on the readme, but I’m not getting the expected output. Anything helps, I’m new to react and whatnot so please go easy on me if I did something stupid. Here’s my code, and an example of what I’m getting instead:

2017-12-21_21-34-05

import React, {Component} from 'react';
import {ToastContainer, toast} from 'react-toastify';
import {Switch, Route, Redirect} from 'react-router-dom';
import {Container} from 'reactstrap';
import Header from '../../components/Header/Header';
import Sidebar from '../../components/Sidebar/Sidebar';
import Dashboard from '../../views/Dashboard/Dashboard';

// Pages
import Monitor from '../../views/Monitor/Monitor';
import SimpleLineIcons from '../../views/Icons/SimpleLineIcons/SimpleLineIcons';

class Full extends Component {
  constructor(props) {
    super(props);

    Full.notify = Full.notify.bind(this);
    Full.error = Full.error.bind(this);
    Full.success = Full.success.bind(this);
  }

  static notify() {
    return toast('Hello World!', {position: "top-center"});
  }

  static error() {
    return toast.error('Danger!');
  }

  static success() {
    return toast.success('Success...');
  }

  render() {

    return (
      <div>
        <button onClick={Full.error}>WEfF</button>
        <ToastContainer autoClose={5000}/>
        <div className="app">
          <Header/>
          <div className="app-body">
            <Sidebar {...this.props}/>
            <main className="main">
              <Container fluid>
                <Switch>
                  <Route path="/dashboard" name="Dashboard" component={Dashboard}/>
                  <Route path="/monitor" name="Buttons" component={Monitor}/>
                  <Route path="/settings" name="Buttons" component={Monitor}/>
                  <Route path="/profile" name="Buttons" component={Monitor}/>
                  <Route path="/icons/simple-line-icons" name="Simple Line Icons" component={SimpleLineIcons}/>
                  <Redirect from="/" to="/dashboard"/>
                </Switch>
              </Container>
            </main>
          </div>
        </div>
      </div>
    );
  }
}

export default Full;

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

7reactions
ProductOfAmericacommented, Dec 25, 2017

Good news, I found the solution to this problem. It occurs if you have two instances of ToastContainer in your project. I accidentally left one in a different component. I think what was happening was the two were conflicting, and one of the components containing the ToastContainer would dismount, causing the toast.whatever() calls to toast to the missing component.

Now we know! 😄

0reactions
ProductOfAmericacommented, Jul 18, 2018

@jeffersoneagley just saying…it was literally in the first code example: chrome_2018-07-18_14-45-43

Also, start a new issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ShowToastEvent notification is not displayed in LWC
I have a problem with Toast Event in Lightning ...
Read more >
LWC Toast messages are not showing in the community
Hi All, I am trying to create a custom LWC component to register users in the community. I want to display the error...
Read more >
Lightning Web Component(LWC) Toast Messages - SfdcPoint
Lightning Web component LWC Toast Messages.LWC can send a toast notification that pops up to alert users of success, error or warning.
Read more >
How to display Toast in Android? - Stack Overflow
Although I start the task on touch event no toast is displayed, not till I close the slider. When the slider is closed...
Read more >
Custom Toast with custom duration In LWC | SalesforceCodex
In few scenerio standard toast message will not work as exptected like in flow and community pages (especially registration page). To show toast...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found