roubachof / Sharpnado.Tabs

Pure MAUI and Xamarin.Forms Tabs, including fixed tabs, scrollable tabs, bottom tabs, badge, segmented control, custom tabs, button tabs, bendable tabs...
MIT License
502 stars 66 forks source link

[MAUI] Empty screen for a few seconds when navigation away and coming back #99

Closed eli191 closed 1 month ago

eli191 commented 9 months ago

Platform (please complete the following information):

Describe the bug

Hello, We have a homepage with tabs. The content of the tabs is presented within the second row of a Grid, and the tabs at the bottom of the screen. The first row of the screen holds a custom view. Inside a tab, if we navigate to another ContentPage and from that page, go back to the home page (where the tabs live), then the screen is empty for a few seconds before the content loads, which is disturbing.

What would be expected would be to have no blank screen.

When navigating to the tabs at app opening, there is no blank screen, only when navigating back.

<ContentPage>
<AbsoluteLayout x:Name="mainContainer" 
                    HorizontalOptions="Fill" 
                    VerticalOptions="Fill" >
        <Grid RowDefinitions="*,60" 
                AbsoluteLayout.LayoutBounds="0,0,1,1" 
                AbsoluteLayout.LayoutFlags="All">

            <Grid 
                AbsoluteLayout.LayoutFlags="All" 
                AbsoluteLayout.LayoutBounds="0, 1, 1, .98" >
                <Grid.RowDefinitions>
                    <RowDefinition Height="160" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>

                <local:HeaderView x:Name="headerView" Grid.Row="0"/> 

                <tabs:ViewSwitcher  x:Name="Switcher"
                                    Grid.Row="1"
                                    Margin="0"
                                    Animate="True"
                                    SelectedIndex="{Binding SelectedViewModelIndex, Mode=TwoWay}"
                                    BackgroundColor="Transparent">
                    <tabs:DelayedView View="{Binding TreatmentsListPage}"
                                        Animate="False"
                                        UseActivityIndicator="True"/>
                    <tabs:DelayedView View="{Binding SchedulingPage}"
                                        Animate="False"
                                        UseActivityIndicator="True"/>
                    <tabs:DelayedView View="{Binding AgendaPage}"
                                        Animate="False"
                                        UseActivityIndicator="True" />
                </tabs:ViewSwitcher>

              </Grid>

                <ContentView Grid.Row="2" BackgroundColor="Silver">
                    <tabs:TabHostView 
                        x:Name="tabHostView"
                        HorizontalOptions="Fill"
                        HeightRequest="60"
                        Padding="0"
                        BackgroundColor="#F8F8F8"
                        CornerRadius="0"
                        IsSegmented="False"
                        Orientation="Horizontal"
                        SelectedIndex="{Binding Source={x:Reference Switcher}, Path=SelectedIndex, Mode=TwoWay}"
                        TabType="Fixed">
                        <tabs:BottomTabItem 
                            x:Name="tab"
                            Style="{StaticResource BottomTab}" 
                            Label="{i18n:Translate s200_title}" >
                        <tabs:BottomTabItem 
                            Style="{StaticResource BottomTab}" 
                            Label="{i18n:Translate s500_title}" />
                        <tabs:BottomTabItem 
                            Style="{StaticResource BottomTab}" 
                            Label="{i18n:Translate s400_title}" />
                    </tabs:TabHostView>
                </ContentView>
            </Grid>
    </AbsoluteLayout>
</ContentPage>

Can you spot anything we may be doing wrong ? Do you have any advice or workaround please ?

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Exceptions (if applicable) N/A

Screenshots (if applicable) If applicable, add screenshots to help explain your problem.

roubachof commented 9 months ago

I don't know, you have only 2 rows in your grid but you set : <ContentView Grid.Row="2" BackgroundColor="Silver"> ?

eli191 commented 9 months ago

@roubachof Thank you so much for spotting that mistake! I am confuse I don't know how I could miss this. I changed it to Grid.Row="1". Unfortunately however, my issue remains exactly the same. :/ I have a blank screen for a few seconds each time I navigate back to the Home page (the page that contains the tabs).

roubachof commented 9 months ago

It's weird... Since it's the whole page, I don't think it's a tabs issue... Normally the page should be still in memory and it should just be underneath. Maybe the way you navigate back to the home page cleans the navigation stack ?

eli191 commented 9 months ago

@roubachof Yes it's weird! That's what I thought, that maybe the page was somehow cleaned up during navigation. But no, I get back on the same tab I was, even on the same position on a list in the tab I was before navigating. It just takes a few seconds to see the home page as it was.

roubachof commented 9 months ago

I would need a video at least to understand what's going on

roubachof commented 5 months ago

will close the issue if no further information.