unoplatform / uno

Build Mobile, Desktop and WebAssembly apps with C# and XAML. Today. Open source and professionally supported.
https://platform.uno
Apache License 2.0
8.63k stars 697 forks source link

[iOS][Android]SwipeControl on ItemsRepeater blanks the app #17238

Open igiona opened 3 weeks ago

igiona commented 3 weeks ago

Current behavior

I have an application which contains a ScrollViewer with a ItemsRepeater that uses the swipe control. I encounter a couple of issues in the different platforms.

iOS and Windows

When I swipe on the control, the app goes blank Video:

https://github.com/unoplatform/uno/assets/1524038/10a35abf-1b85-4689-bd83-059a857776af

Android:

The first time a Swipe on an Item after starting the app, the movement of the element has a lag of a 1 to 2 seconds. Afterwards it's smooth Video:

https://github.com/unoplatform/uno/assets/1524038/84749794-ebe4-4f58-b240-0d76cfac32f4

Expected behavior

Swiping on a ItemsRepeater is always smooth and doesn't blank the app.

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

Clone and run https://github.com/igiona/uno-repro-ItemsRepeaterSwipe

The changes on top on the default Uno App from the template are: https://github.com/igiona/uno-repro-ItemsRepeaterSwipe/commit/c8ed2d37c227278c39ab1d9c71dc65352ed3a241

Workaround

None

Works on UWP/WinUI

No

Environment

No response

NuGet package version(s)

No response

Affected platforms

Android, iOS, Windows (WinAppSDK)

IDE

Visual Studio 2022

IDE version

Version 17.10.2

Relevant plugins

No response

Anything else we need to know?

Other platforms might be affected, but I did not tested them.

igiona commented 3 weeks ago

I've been able to narrow down the issue a bit further.

-      <ItemsRepeater ItemsSource="{Binding Records}" uen:Navigation.Request="List_Template">
+      <ItemsRepeater ItemsSource="{Binding Records}" >

Without the Navigation.Request, the swiping works as expected also on iOS and on Android I don't get the lag anymore.

I guess that it explains why the page went blank, since I don't have a "List_Template" page registered in the navigation. "Sadly" that line of code comes directly from the Uno plugin for Figma 😢 , I blindly trusted it... maybe this can be seen as a bug there? I don't know though why is it set like that as default..

I still do not understand why on Android the navigator behaves differently though, maybe you guys do? 😃

On Windows as well, the app doesn't go blank anymore but I still can't swipe the item. Maybe it's because I'm using my mouse? is there some Windows setting that has to be enabled perhaps?

agneszitte commented 3 weeks ago

I guess that it explains why the page went blank, since I don't have a "List_Template" page registered in the navigation. "Sadly" that line of code comes directly from the Uno plugin for Figma 😢 , I blindly trusted it... maybe this can be seen as a bug there? I don't know though why is it set like that as default..

cc @carldebilly in case you have additional feedback regarding the plugin

Youssef1313 commented 2 weeks ago

@nickrandolph Are we doing reflection when having Navigation.Request? Could we optimize it using a source generator or something?

nickrandolph commented 2 weeks ago

@nickrandolph Are we doing reflection when having Navigation.Request? Could we optimize it using a source generator or something?

Only if routes aren't defined. Yes, long term source generator might help with route definitions