Sharpnado.TaskLoaderView icon indicating copy to clipboard operation
Sharpnado.TaskLoaderView copied to clipboard

The result/error template is not displayed when first loaded in MAUI-7.0

Open rwecho opened this issue 1 year ago • 4 comments

Platform (please complete the following information):

  • OS: [Android]
  • Device: [AndroidEmulator/ Android Phone]
  • SDK version: [Android SDK 30]
  • MAUI-7.0

Describe the bug The result/error template is not displayed when loaded first, but it's ok in the next refreshing, and it's ok when the view is tapped.

I remove the ScrollView surrounding the tlv:TemplatedTaskLoader</tlv:TemplatedTaskLoader>, it's ok. I doubt there is a lack of focus behavior in the ScrollView.

To Reproduce Cover the default demo with CommandsPage in the Retronado.Maui project.

The issue XAML

 <RefreshView    IsRefreshing="{Binding Loader.ShowRefresher}"
                         RefreshColor="{StaticResource Primary}"
                         Command="{Binding Loader.RefreshCommand}">
        <ScrollView>
            <tlv:TemplatedTaskLoader TaskLoaderNotifier="{Binding Loader}">
                <tlv:TemplatedTaskLoader.ResultControlTemplate>
                    <ControlTemplate>
                        <VerticalStackLayout
                    x:DataType="local:MainPageViewModel"
                                    BindingContext="{Binding Source={RelativeSource
                                        AncestorType={x:Type local:MainPageViewModel}}}">
                            <Label Text="hello world"></Label>
                            <Label Text="{Binding Loader.Result}"></Label>
                        </VerticalStackLayout>
                    </ControlTemplate>
                </tlv:TemplatedTaskLoader.ResultControlTemplate>

                <tlv:TemplatedTaskLoader.LoadingControlTemplate>
                    <ControlTemplate>
                        <ActivityIndicator Color="{StaticResource Primary}"
                                                    IsRunning="True"
                                                    HorizontalOptions="Center"
                                                    VerticalOptions="Center" />
                    </ControlTemplate>
                </tlv:TemplatedTaskLoader.LoadingControlTemplate>

                <tlv:TemplatedTaskLoader.ErrorControlTemplate>
                    <ControlTemplate>
                        <VerticalStackLayout BindingContext="{Binding Source={RelativeSource AncestorType={x:Type tlv:TemplatedTaskLoader}},
                                              Path=TaskLoaderNotifier}"
                                             x:DataType="tlv:ITaskLoaderNotifier">
                            <Label Text="{Binding Error}"></Label>
                        
                        </VerticalStackLayout>
                    </ControlTemplate>
                </tlv:TemplatedTaskLoader.ErrorControlTemplate>
            </tlv:TemplatedTaskLoader>
        </ScrollView>
    </RefreshView>

The workaround XAML

 <RefreshView    IsRefreshing="{Binding Loader.ShowRefresher}"
                         RefreshColor="{StaticResource Primary}"
                         Command="{Binding Loader.RefreshCommand}">
        <tlv:TemplatedTaskLoader TaskLoaderNotifier="{Binding Loader}">
            <tlv:TemplatedTaskLoader.ResultControlTemplate>
                <ControlTemplate>
                    <ScrollView>
                    <VerticalStackLayout
                x:DataType="local:MainPageViewModel"
                                BindingContext="{Binding Source={RelativeSource
                                    AncestorType={x:Type local:MainPageViewModel}}}">
                        <Label Text="hello world"></Label>
                        <Label Text="{Binding Loader.Result}"></Label>
                    </VerticalStackLayout>
                    </ScrollView>
                </ControlTemplate>
            </tlv:TemplatedTaskLoader.ResultControlTemplate>

            <tlv:TemplatedTaskLoader.LoadingControlTemplate>
                <ControlTemplate>
                    <ActivityIndicator Color="{StaticResource Primary}"
                                                IsRunning="True"
                                                HorizontalOptions="Center"
                                                VerticalOptions="Center" />
                </ControlTemplate>
            </tlv:TemplatedTaskLoader.LoadingControlTemplate>

            <tlv:TemplatedTaskLoader.ErrorControlTemplate>
                <ControlTemplate>
                    <ScrollView>
                    <VerticalStackLayout BindingContext="{Binding Source={RelativeSource AncestorType={x:Type tlv:TemplatedTaskLoader}},
                                          Path=TaskLoaderNotifier}"
                                         x:DataType="tlv:ITaskLoaderNotifier">
                        <Label Text="{Binding Error}"></Label>
                        
                    </VerticalStackLayout>
                    </ScrollView>
                </ControlTemplate>
            </tlv:TemplatedTaskLoader.ErrorControlTemplate>
        </tlv:TemplatedTaskLoader>

    </RefreshView>

There is no issue with the Windows platform. I just test on Android and Windows.

rwecho avatar Jul 05 '23 09:07 rwecho