adospace / reactorui-maui

MauiReactor is a MVU UI framework built on top of .NET MAUI
MIT License
597 stars 50 forks source link

When using Shell's TabBar, navigated page are unmounted on tab switching #257

Open nomurayoshuak opened 3 days ago

nomurayoshuak commented 3 days ago

Describe the bug & To Reproduce I am using the following Shell setup in MainPage. Within HomePage, I navigate to a lower-level page (like Page6, which is not included in the tabs). When I switch to another tab (e.g., Tab2 or Tab3) and then return to the Home tab, Page6 remains visible, but the Page6 component is unmounted, causing any buttons or other elements on Page6 to become completely non-functional.

I believe that unmounting the component at this timing is a bug. I am currently facing this issue in an ongoing project, and I would greatly appreciate your assistance in resolving it. Thank you.

// MainPage
public override VisualNode Render()
    => Window(
        Shell(
            TabBar(
                ShellContent("Home")
                    .Icon(/* icon */)
                    .RenderContent(() => new HomePage()),
                ShellContent("Tab2")
                    .Icon(/* icon */)
                    .RenderContent(() => new Page2()),
                ShellContent("Tab3")
                    .Icon(/* icon */)
                    .RenderContent(() => new Page3()),
                ShellContent("Tab4")
                    .Icon(/* icon */)
                    .RenderContent(() => new Page4()),
                ShellContent("Tab5")
                    .Icon(/* icon */)
                    .RenderContent(() => new Page5())
            )
            .Route("mainpage")
    )
);

// Navigation in the HomePage
await Navigation.PushAsync<Page6>(new Page6());

Smartphone (please complete the following information):

Additional context I tested on android only. I didn't test on iOS.

nomurayoshuak commented 2 days ago

@adospace I'm sorry, I wrote wrong comment. Page2 is incorrect Page6 is correct. I fixed the above my comment.