question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Toast onClose not firing

See original GitHub issue

Issue Description

It looks like the Toast onClose property isn’t firing for me in any case. This is happening both on Android an iOS.

Example: https://snack.expo.io/3r4vae3LY

node, npm, react-native, react and native-base version, expo version if used, xcode version

“react-native”: “0.63.0”, “native-base”: “^2.13.13”, “react”: “16.13.1”,

Expected behaviour

The onClose function actually gets called

Actual behaviour

onClose is never called.

Steps to reproduce

Just try to add an onClose to a Toast and it should not work.


const Test = () => (
  <Button
    title="Show Toast"
    onPress={() => {
      Toast.show({
        text: "This is the toast",
        duration: 5000,
        buttonText: "click me",
        onClose: (reason) => {
          // this is never fired in any case, whether clicking on buttonText or letting it self-dismiss
          console.warn(reason);
          throw new Error('should error');
        },
      })
    }}
  />
)

Is the bug present in both iOS and Android or in any one of them?

Both

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:14 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
hanykumarcommented, Sep 16, 2020

Hi @Michael-M-Judd , we just published a new version 2.13.14 with the latest dependency fixes. Can you please upgrade and let us know if the issue still persists?

1reaction
eggybotcommented, Aug 18, 2020

any solution for this one? I found out that the latest version is affecting the react-navigation Tabs. I’m using the latest version

....
"react-native": "0.63.2",
"native-base": "2.13.13",
"@react-navigation/bottom-tabs": "^5.8.0",
"@react-navigation/drawer": "^5.9.0",
"@react-navigation/native": "^5.7.3",
"@react-navigation/stack": "5.9.0",
....
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to trigger React Toastify onClose only after toast closes?
The following code renders a toast: import { ToastContainer, toast } from "react-toastify"; import "react-toastify/dist/ReactToastify.css"; ...
Read more >
Troubleshooting Checks that Will Not Close - Toast Central
If it is past the prep time for the order, the check will fire immediately. If it has a payment on it, the...
Read more >
Define callback | React-Toastify - GitHub Pages
Define callback. You can define two callbacks. Their names are self-explanatory: onOpen; onClose.
Read more >
Toasts - Bootstrap
This event is fired when the toast has finished being hidden from the user. Copy. $('#myToast').on( ...
Read more >
react-toastify - npm
Ensure not to render any toast that has containerId . ... onOpen is called inside componentDidMount; onClose is called inside ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found