New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: null is not an object (evaluating 'this.toastInstance._root.showToast') #1790
Comments
@patrickalbani NativeBase is on 2.4.2 |
Upgrade version, still the same. My package.json:
|
I have reproduced the same issue. Steps to reproduce
Screenshot of emulatorpackage.json
|
same issue on reopen app |
Same here @2.4.3 Edit: Setting toastInstance to null on willMount or willUnmount does the trick for me (See #739):
|
Fixed with 2.5.0 |
Wrapping the component in |
thank you. works fine👌👌 |
I'm getting the error in v2.8.1 |
If I call the Toast from Redux, should I wrap the |
Ok - I'm getting this same error with Happens both on Android and iOS devices. |
We're having the same issue as @grahammcculloch. Maybe this issue should be reopened? |
Same issue with
|
I see the same issue too. I'm on |
Same issue. @abhiram-n Did you find any solution or workaround on this? I am also using "native-base": "^2.12.1" |
@yogini-bende i sometimes see it as an error report in the sentry. do you know in which cases it happens. do you have still this issue in |
This is my showToast function, where I am calling toast from native-base.
and this is the function where I am using that showToast method,
handleFirstConnectivityChange is throwing this error and no workaround is working. I have even tried to upgrade native-base to 2.13.0 , but no luck. Can you suggest something @BatDroid |
@yogini-bende I believe I got around this by hiding the toasts in componentWillUnmount:
|
I am also seeing the same issue with v2.13.8. My top level component is already wrapped with |
I am also facing this issue with v2.12.1. I've wrapped my top level component with |
Same issue, also wrapped in a , also on native base 2.13.8. |
I am too getting this issue on native-base 2.13.8. Could someone share the workaround for this? |
I am using Root as top level component. This issue only seems to occur when I ask the user for permissions. (permissions alert/popup seems to be outside root or interfering with root causing this issue) |
I'm getting it too with the same use case as @pango89 |
Yep I am also seeing this in Sentry logs: Error:
package.json
App.js render method:
|
try this, using it for a month or two...so far so good... import React, {useCallback, useRef} from "react";
// Solution based on the one here: https://github.com/GeekyAnts/NativeBase/issues/985#issuecomment-411379940
import {Container as ContainerNB, NativeBase, Toast as ToastNB} from "native-base";
import {useFocusEffect} from "@react-navigation/native";
class Toast extends ToastNB {}
const Container = ({children, ...props}: NativeBase.Container & {children: any}) => {
const toastInstance = useRef();
useFocusEffect(useCallback(() => {
if (toastInstance.current && toastInstance !== (Toast as any).toastInstance) {
(Toast as any).toastInstance = toastInstance.current;
}
}, []));
return <ContainerNB {...props}>
{/*Needs to be first*/}
{children}
{/*// @ts-ignore*/}
<Toast
ref={c => {
if (c) {
(Toast as any).toastInstance = c;
toastInstance.current = c;
}
}}
/>
</ContainerNB>;
}; |
I am also getting the issue in version 2.13.14 |
I am using native base "native-base": "^2.13.14", still not fiexd |
I'm having this issue on 2.15.2 |
Using "native-base": "^2.3.3"
My App:
Using android.
The case happens when a i started my app, click in back button until minimize the app, then open app, after this, happens the error.
The text was updated successfully, but these errors were encountered: