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.

closeAllModals() and others sometimes do not run

See original GitHub issue

I’ve updated to the latest 3.3.0 release. But now I’m seeing another issue.

In my app, when I navigate the user to another screen, I like to close all open modals (sometimes the user is navigated due to a change in data, for example where they are being attacked by another player, so I need to react to it).

I’m seeing intermittent behavior where closeAllModals() is not being run at all though. I’ve passed in a logging callback, and usually I don’t see that logged, and the modal stays open on top of the navigation change below the modal, so the user doesn’t notice they are being attacked.

I even log currentModal immediately before to check if there is a currentModal open, and it is correct. Any ideas?

  const navToAttack = async () => {
    props.navigation.navigate("attack", {
      attackId: user.attackId
    closeAllModals(() => {
      console.log('closed all')

When the modal stays open occasionally, I just see the currentModal logged, but no callback logging: MainMenuModal

Where in the code could I manually do some logging in your plugin to help troubleshoot? I tried adding logging to both files’ functions and rebuilding, but I never see the added statement logged: node_modules\react-native-modalfy\lib\commonjs\lib\ModalState.js node_modules\react-native-modalfy\lib\module\lib\ModalState.js

  const closeAllModals = () => {
    console.log('test closeAllModals')
    const {
    } = state.stack;
    setState(currentState => ({
      currentModal: null,
      stack: { ...currentState.stack,

Thanks for any help in troubleshooting this issue!

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

otaviogaiaocommented, Jun 24, 2022

Hey @otaviogaiao! Did you try to invoke your callback as mentioned in the docs? If you can submit a repro on Snack, that’d be very helpful!

I tried to replicate this error in a snack, but couldn’t. I will check my code again to see if im doing something wrong. I will post if I find out anything. Thanks

CharlesMangwacommented, Jun 20, 2022

Hey @otaviogaiao! Did you try to invoke your callback as mentioned in the docs? If you can submit a repro on Snack, that’d be very helpful!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bootstrap close modal not working - Stack Overflow
The first is the close icon and the other one is cancel button, both use data-dismiss to close the modal. However, both of...
Read more >
Forcefully close all open modals · Issue #2618 - GitHub
I have several modals in various components. I don't have a reference to all modals from a central location, so i can't call...
Read more >
10 Most Common Bootstrap Mistakes That Developers Make
Bootstrap doesn't support overlapping modals. Only one modal at the time can be visible. Showing more than one modal at a time can...
Read more >
Modal · Bootstrap v5.2
Use Bootstrap's JavaScript modal plugin to add dialogs to your site for lightboxes, user notifications, or completely custom content.
Read more >
ion-modal: Ionic Mobile App Custom Modal API Component
ion-modal is a dialog that appears on top of mobile app content, and must be ... If canDismiss is false , then the...
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 Post

No results found

github_iconTop Related Hashnode Post

No results found