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.15k stars 122 forks source link

Add extraAttributes support #780

Closed Dolfik1 closed 2 years ago

Dolfik1 commented 4 years ago

At this moment we can add extra attributes via WithAttribute function. This way is very slow because we duplicate element on each WithAttribute call. This PR adds extraAttributes key to all views:

View.Label(
  text = "Hello, world!",
  extraAttributes = [
    key "helloworld"
    row 0
    column 1
  ]
)

extraAttributes preallocates space in beginning of array and call WithAttribute function for each value in extraAttributes.

SergejDK commented 2 years ago

I discussed this with @TimLariviere and this will be available in Fabulous v2 which he currently works on.

I will close this PR because this is planned in v2 with a new way for handling this.