fabulous-dev / Fabulous

Declarative UI framework for cross-platform mobile & desktop apps, using MVU and F# functional programming
https://fabulous.dev
Apache License 2.0
1.13k stars 122 forks source link

[Bug] Android Control extension UpdateEvent make the Ui freeze #903

Closed edgarfgp closed 2 years ago

edgarfgp commented 2 years ago

Description

Steps to Reproduce

  1. Create a new fabulous App using dotnet new fabulous-xf-app -n
  2. install CC.CircularSlider.Forms in all 3 projects
  3. Create an extension for this Control . See the Repro attached

Expected Behavior

When creating control extension using https://fsprojects.github.io/Fabulous/Fabulous.XamarinForms/view-a-extensions.html the behaviour should be the same in both platforms . Currently only works on iOS

Actual Behavior

When creating control extension using https://fsprojects.github.io/Fabulous/Fabulous.XamarinForms/view-a-extensions.html only works on iOS

Not that the Slider is been reset to a random position after you interact with it

https://user-images.githubusercontent.com/31915729/145804535-fb9b22be-4ce1-4228-b667-17de6c9540cd.mp4

https://user-images.githubusercontent.com/31915729/145804367-2813e88a-0b37-4948-a025-539fa583b4a6.mov

Basic Information

I think the main problem could possible be in how(Fabulous) register and unregister the events coming from a third party library and affects android specifically .

As a side not this does not seem the be a BUG in the Upcoming Fabulous V2 that currently is in Progress.

Environment

Build Logs

Screenshots

Reproduction Link

For convenience . Here is the repo with the minimal repro https://github.com/edgarfgp/fabulous-extensions-repro

Workaround

In order to ensure that the Extensions is generated using the correct approach I have used the Fabulous Extension Code generation tool

https://github.com/edgarfgp/fabulous-extensions-repro/commit/1227d7724a0ef710e97a5ed3d28bcf33afe74089

edgarfgp commented 2 years ago

There seems to be a limitation when dispatching messages on a deep MVU hierarchy . So The Update source.UpdateEvent works fine at the root Level . But if you move this down in hierarchy and pass the dispatch function and then the Update method is not able to dispatch events properly on Android.

So I would say this is a limitation of the when dispatching msgs deep down in the hierarchy. and an android BUG specifically.

edgarfgp commented 2 years ago

I have found a fix . You can find more info here https://github.com/edgarfgp/fabulous-extensions-repro/commit/1227d7724a0ef710e97a5ed3d28bcf33afe74089

edgarfgp commented 2 years ago

Closing this issue as v2 android handles this more gracefully