Undefined is not an object (evaluating '_this.refs.toast.show)
Hey guys, i stumbled on this problem even after confirming the import of the module in my project, Any way forward please?
Try
this.toastRef.show('Hello!');
and set the ref with:
<Toast
ref={ref => {
this.toastRef = ref;
}}
...
/>
@xeroxoid , i met the same error, have tried the method u mentioned, but not work and new error given: null is not an object(evaluating '_this.toastRef.show')
I tried this and it works:
<Toast
ref={toast => {
this.toast = toast;
}}
/>
and then do
this.toast.show(`${error.message}`);
Let me know if it works.
I tried this and it's work for me:
Define in constructor this.toast = null
set the ref
<Toast ref={ref => { this.toast = ref; }} />
and then this.toast.show(${error.message});
Maybe it could work for you!
@vikrantnegi thanks! Working perfectly!