unoplatform/uno

Remove reflection to Uno.Toolkit

Open

#782 opened on Apr 17, 2019

View on GitHub
 (1 comment) (0 reactions) (0 assignees)C# (9,789 stars) (837 forks)batch import
area/performance 📈difficulty/starter 🚀good first issuekind/enhancementlow-hanging-🍒no-repro

Description

I'm submitting a...

  • Feature request

Current behavior

Currently some classes in Uno.UI are using reflection to access classes in the toolkit and interact with them. This is not extensible, and in some cases the dependency can be inverted.

For instance Android's NativeFramePresenter seek for the CommandBarExtensions https://github.com/nventive/Uno/blob/master/src/Uno.UI/NativeFramePresenter.Android.cs#L28 in order to update the visibility of the back button (https://github.com/nventive/Uno/blob/master/src/Uno.UI/NativeFramePresenter.Android.cs#L81).

Expected behavior

No cross-layer dependencies.

For the example above, the CommandBar could instead walk the tree to discover the Frame and register to the history change events to update the visibility by itself.

Minimal reproduction of the problem with instructions

N/A

Environment

Nuget Package: Uno.UI Package Version(s): irrelevant

Affected platform(s):

  • iOS
  • Android
  • WebAssembly
  • Windows
  • Build tasks

Visual Studio: irrelevant Relevant plugins: none

Contributor guide