MPowerKit / VirtualizeListView

.NET MAUI ListView renderers. Improves performance for MAUI ListView, adds additional behaviors
MIT License
69 stars 10 forks source link

Scroller Jumps to Start Position when Entry Control Gains Focus in VirtualizeListView #5

Closed swapnilpopatgaikwad closed 1 month ago

swapnilpopatgaikwad commented 1 month ago

When using the VirtualizeListView component with Entry controls inside it, the scroller scrolls to the start position whenever an Entry control gains focus. This issue disrupts the user experience, especially in scenarios where users need to input data into multiple entries within a scrolled position in the list.

Steps to Reproduce:

  1. Create a VirtualizeListView with multiple Entry controls as items.
  2. Scroll down to any position in the list.
  3. Focus on any Entry control by tapping on it.
  4. Observe that the scroller jumps to the start position, causing the user to lose their place in the list.

Expected Behavior: The scroller should maintain its current position when an Entry control gains focus, allowing users to continue inputting data without losing their place in the list.

Actual Behavior: The scroller jumps to the start position whenever an Entry control gains focus, disrupting the user's input flow.

Alex-Dobrynin commented 1 month ago

Can you add repro project as .zip here please? also you may provide video of this behavior (optional)

swapnilpopatgaikwad commented 1 month ago

Demo project repo : https://github.com/swapnilpopatgaikwad/VirtualListDemo.git Zip File : VirtualListDemo.zip

Code Sample :

<Grid RowDefinitions="*">
    <mpowerkit:VirtualizeListView x:Name="listView"
                                  Grid.Row="0"
                                  Padding="15"
                                  ItemsSource="{Binding DataModels}"
                                  IsGrouped="False">
        <mpowerkit:VirtualizeListView.ItemTemplate>
            <DataTemplate x:DataType="model:DataModel">
                <mpowerkit:VirtualizeListViewCell>
                    <Grid ColumnDefinitions="*"
                          ColumnSpacing="15"
                          RowDefinitions="*,*,*"
                          RowSpacing="10">
                        <StackLayout Grid.Column="0"
                                     Grid.Row="0"
                                     Orientation="Horizontal"
                                     HorizontalOptions="FillAndExpand"
                                     VerticalOptions="Center">
                            <Label FontSize="22"
                                   Text="{Binding Id}" />
                            <Label FontAttributes="Bold"
                                   FontSize="22"
                                   Text="{Binding Title}" />
                        </StackLayout>
                        <Entry Grid.Row="1"
                               Grid.Column="0"
                               FontSize="18"
                               HorizontalOptions="FillAndExpand"
                               BackgroundColor="Red"
                               Text="{Binding Description}" />
                        <BoxView Grid.Column="0"
                            Grid.Row="2"
                            HeightRequest="1" BackgroundColor="Black"/>
                    </Grid>
                </mpowerkit:VirtualizeListViewCell>
            </DataTemplate>
        </mpowerkit:VirtualizeListView.ItemTemplate>
    </mpowerkit:VirtualizeListView>
</Grid>

Video :

https://github.com/user-attachments/assets/c776b77a-b7e2-4604-940e-66b9f3d6bdff

Alex-Dobrynin commented 1 month ago

does this happen only on android or on ios also?

swapnilpopatgaikwad commented 1 month ago

Currently, I am facing this issue on Android only. I checked on iOS, and it's working fine.