Unverified Commit 677b2881 authored by Diego Mello's avatar Diego Mello Committed by GitHub
Browse files

[FIX] Prevent toast ref error (#1744)

parent 290c53ef
......@@ -43,15 +43,19 @@ class Toast extends React.Component {
EventEmitter.removeListener(LISTENER);
}
getToastRef = toast => this.toast = toast;
showToast = ({ message }) => {
this.toast.show(message, 1000);
if (this.toast && this.toast.show) {
this.toast.show(message, 1000);
}
}
render() {
const { theme } = this.props;
return (
<EasyToast
ref={toast => this.toast = toast}
ref={this.getToastRef}
position='center'
style={[styles.toast, { backgroundColor: themes[theme].toastBackground }]}
textStyle={[styles.text, { color: themes[theme].buttonText }]}
......
Markdown is supported
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