Unverified Commit fae46f56 authored by Reinaldo Neto's avatar Reinaldo Neto Committed by GitHub
Browse files

Chore: Migrate containers: Toast to Typescript (#3913)

parent 75f3f909
......@@ -26,9 +26,9 @@ interface IToastProps {
}
class Toast extends React.Component<IToastProps, any> {
private listener: any;
private listener?: Function;
private toast: any;
private toast: EasyToast | null | undefined;
componentDidMount() {
this.listener = EventEmitter.addEventListener(LISTENER, this.showToast);
......@@ -43,12 +43,14 @@ class Toast extends React.Component<IToastProps, any> {
}
componentWillUnmount() {
EventEmitter.removeListener(LISTENER, this.listener);
if (this.listener) {
EventEmitter.removeListener(LISTENER, this.listener);
}
}
getToastRef = (toast: any) => (this.toast = toast);
getToastRef = (toast: EasyToast | null) => (this.toast = toast);
showToast = ({ message }: any) => {
showToast = ({ message }: { message: string }) => {
if (this.toast && this.toast.show) {
this.toast.show(message, 1000);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment