callstack / react-native-paper

Material Design for React Native (Android & iOS)
https://reactnativepaper.com
MIT License
12.76k stars 2.08k forks source link

Menu + Navigation is not clearing the PortalManager #4319

Open rveltonCL opened 7 months ago

rveltonCL commented 7 months ago

I am running into an issue that if a navigate on a menu item press, the PortalManager is not getting cleared out and then capturing subsequent screen interactions. I am doing some pretty simple navigation using the following code:

    const closeMenu = () => {
        console.log('closeMenu');
        setVisible(false);
    };

    const navigateToStaticWebView = (itemKey: string) => {
        navigation.push('StaticWeb', {
            ...webViews[itemKey as keyof typeof webViews],
        });
    };

And here is the menu item that is calling it:

                <Menu.Item
                    title="About"
                    leadingIcon="information-outline"
                    onPress={() => {
                        closeMenu();
                        navigateToStaticWebView('about');
                    }}
                />

I figure that I am just doing something dumb or missing something simple, but this has been throwing me for a loop for a few days. Any help or documentation would be greatly appreciated, thanks.

rveltonCL commented 7 months ago

The one thing I will mention... If I add a half second delay after tap, the next page works fine and the Portal Manage is unloaded properly. Again, if anyone has any insight or work arounds, I would greatly appreciate it.

Benayed-Mohamed commented 2 weeks ago

I am encountering the same situation , any updates about how to remove the delay and directly navigate to the desired page ? thanks