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

Snackbar gets dismissed immediately when closing the Modal - Android #157

Closed
durdevic opened this issue Jun 29, 2020 · 2 comments
Closed

Comments

@durdevic
Copy link

I thought this was a fix for it but still occurs. #155

So I'm showing the Snack once the closeModal (made from react-native-modal component) is triggered.

On Android it gets shown for a split second and then dismissed. I thought it was because of re-rendering, but when I moved it to other component, it's the same behaviour. I also tried LENGTH_INDEFINITE, still no luck.

Is there a special way to tackle it with Modals on Android?

I also tried extracting the function and triggering it outside of the return section, still an issue.

On iOS it works smoothly.

       <FoldersListModal
                isOpen={showFolderListModal}
                closeModal={res => {
                    setShowFolderListModal(false);
                    if (res) {
                        Snackbar.show({
                            text: `Moved to `,
                            duration: 3000,
                            action: {
                                text: 'View',
                                // onPress: () => actionFunction(),
                                textColor: GREEN
                            }
                        });
                    }

                }}
            />
@cooperka
Copy link
Owner

cooperka commented Jul 3, 2020

Thanks for the info @durdevic. Merging into #28.

Please try the setTimeout workaround so the snackbar doesn't get attached to the view that's being closed.

@nikita-fuchs
Copy link

I have the exact same issue on desktop:

        let snackConfig : MatSnackBarConfig = {
          duration: 3000
        }
        this.snackbarRef = this.snackbar.open("Setting signature successful", "foo", snackConfig)
        ```
it appears for a brief millisecond and disappears again immediately.

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

No branches or pull requests

3 participants