Error: <SHOW_TOAST> Event is not registered.
See original GitHub issueEdit: 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:
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:
- Created 6 years ago
- Comments:13 (5 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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! 😄
@jeffersoneagley just saying…it was literally in the first code example:
Also, start a new issue.