unoplatform / uno

Open-source platform for building cross-platform native Mobile, Web, Desktop and Embedded apps quickly. Create rich, C#/XAML, single-codebase apps from any IDE. Hot Reload included! 90m+ NuGet Downloads!!
https://platform.uno
Apache License 2.0
8.97k stars 730 forks source link

[Gallery][iOS/Mac Catalyst] FlipView first load automatically scrolls past the last item #8104

Closed sakshi173 closed 2 years ago

sakshi173 commented 2 years ago

Current behavior

https://user-images.githubusercontent.com/74563602/154142383-0175eb55-f306-4e73-9439-aa4ef062b9fa.MOV

Expected behavior

when Flipview first loaded control should shows the proper item.

https://user-images.githubusercontent.com/74563602/156660622-b44df00a-ee12-442c-a77f-3ce15948e32d.mp4

How to reproduce it (as minimally and precisely as possible)

  1. Open Uno Gallery APP
  2. Tap Burger Menu on the left top right.
  3. Tap "Flipview" from the "Features" list.
  4. Observe that the when Flipview first loaded control should shows the proper item. No response

Workaround

No response

Works on UWP/WinUI

No response

Environment

No response

NuGet package version(s)

No response

Affected platforms

iOS

IDE

No response

IDE version

No response

Relevant plugins

No response

Anything else we need to know?

No response

ghost commented 2 years ago

@sakshi173 Hi! Do you mind to say what device did you use in your video or even to repeat the test please? I tried to reproduce the steps, using an iphone 7 and the speed was acceptable. The first item was presented as expected and didn`t flip automatically.

francoistanguay commented 2 years ago

Pretty sure it's not about the speed but the fact that it automatically scrolls (flips) past the last item.

So ignore the comment about speed or needing to be faster, and le'ts make sure the control shows the proper item when loaded.

ghost commented 2 years ago

Right! However, even that problem didn`t happened with me. Everything is working fine.

francoistanguay commented 2 years ago

Ok so move to the next one and will let @sakshi173 try to reproduce on latest Canary. Maybe it got fix by something else.

sakshi173 commented 2 years ago

@francoistanguay and @iury-kc, Sure whenever I will receive the latest canary build for iOS, I will try to reproduce it and update the status accordingly.

sakshi173 commented 2 years ago

@iury-kc, Today I retested this bug with latest iOS canary build and still getting the same issue(below is the video). Device -iPhone12, Software Version 14.1 and canaries build(Testflight) Version 1.5.0 (887), Release Date Mar 9, 2022

https://user-images.githubusercontent.com/74563602/157523508-8e018ae9-a409-4f8d-81b8-bf2542ea1173.MOV

ghost commented 2 years ago

Hi @sakshi173 Thanks for your time! I have the Uno Gallery 1.4.1 at iPhone 7, Software Version 15.3.1. I'll try using the simulator, and the dev version of Uno Gallery so.

https://user-images.githubusercontent.com/100223422/157645000-391a281e-8eb6-4353-9b8c-a7df548d2b08.MP4

jeromelaban commented 2 years ago

@iury-kc you'll need to build a version of the gallery using the latest master to get the issue.

ghost commented 2 years ago

Got it !! Thanks! Running on the simulator, the last master i could see the first Item for a couple of seconds. Suddenly, the last item cames out. It seams something is firing the scrow to last item.
I'll investigate the cause.

ghost commented 2 years ago

Running a simple APP with the last master commit, the problem is a little bit different, but occurs on Android and iPhone as well. XAML as simple as:

 <FlipView x:Name="flipView" Height="600" SelectedIndex="0">
                <FlipViewItem>
                    <Grid Background="#550000">
                        <StackPanel VerticalAlignment="Center">
                            <TextBlock Text="Item 1" Foreground="White" HorizontalAlignment="Center" />
                            <TextBlock Text="&#x2190; Swipe" Foreground="White" HorizontalAlignment="Center" Margin="0,0,46,0" />
                        </StackPanel>
                    </Grid>
                </FlipViewItem> // as many items as we want

Both Android and iOS doesn't show the FlipView. It only appears when we touch the region of the screen and do some drag. Then, the last item appears. As it is a recent behavior, since it doesn't happen on released version, I verified the last commits. At this line: https://github.com/unoplatform/uno/blob/edd03487b472643edc1989c18c87cc74ad81dbec/src/Uno.UI/UI/Xaml/Controls/Primitives/Selector.cs#L398

The value of selectedIndexToSet reaches the Items.Count value. As index is base 0, it will try to select an inexisting item.

Just for TESTING PURPOSES, forcing SelectedIndex backing to 0, when the behavior above occurs, the FlipView works fine. Obviously, the issue's root is not there.

ghost commented 2 years ago

https://github.com/unoplatform/uno/blob/edd03487b472643edc1989c18c87cc74ad81dbec/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_FlipView.cs#L21

As the above TestMethod is enough to test the behavior, i don't think it's necessary to create another one just for this issue. On the other hand, it's a little bit strange that the existing test was passed, since the SelectedIndex didn't start with 0.

sakshi173 commented 2 years ago

I verified issue for iOS and issue is fixed closing.