Skip to content
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

toast.hide('id') doesn't work. Only hides toast when touching screen after calling the toast.hide('id') function #149

Open
nikki-cat opened this issue Jul 29, 2022 · 4 comments

Comments

@nikki-cat
Copy link

I am using a button to show and then hide a toast with the same ID.
Somehow I can't manually get the toast to hide. I am making sure to use a unique ID, used only for this one toast.
I can update some things like "message" or "type", which are reflected immediately, but even if I update duration to be only 1 second, it still wont go away, until I interact with the screen.
toast.hideAll() also doesnt work until the screen has been touched,

I am providing Toast using the alternative way, as shown here:
https://github.com/arnnis/react-native-toast-notifications#--how-to-call-toast-outside-react-components

This is all happening with a button press inside a component.

Any help please?

@nikki-cat
Copy link
Author

Actually after some more googling i came across this: https://stackoverflow.com/questions/56044770/ui-doesnt-update-until-tap-on-the-screen-when-setstate-is-called-inside-a-realm

It seems to be something to do with having Debug enabled in chrome... The example given on this repo is through Expo, but we don't use that.

Just like in that link, it fixes itself after Debug is turned off... Not sure how this could be addressed.
There's a big discussion here about this, which could be related: facebook/react-native#5712 (comment)

@nikki-cat
Copy link
Author

Anyway, for now, it's probably not an immediately huge issue since it will work in production (hopefully).

@chengwb53
Copy link

same issue, toast.hideAll and toast.hide doesn't work

@YaoHuiJi
Copy link

For me, I create my own custom toast type, but the "toast" parameter passed by ToastProvider has no hide/hideAll etc, but I found a temporary solution, you can call useToast to get your own toast object which has hide/hideAll methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants