You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the example what I want for MyWidget is to set background to white and leave border-brush to black, as it is defined in MyBase. But currently it doesn't work. What happens instead is that background is set to black and all not set field of the structs are set to the defaults. So in case of border-brush to transparent.
The text was updated successfully, but these errors were encountered:
The change as proposed is a breaking change.
We could come up with a new syntax for doing that. Like a "merge" operator.
So one option would be:
exportcomponentMyWidgetinheritsMyBase {
// Option 1: have a . syntax to override only sub-field of a struct
style.background: #fff;
//Option 2: use a different symbol to merge
style ~: { background: #fff }
// Also make sense with callback and stuff
clicked => { root.style ~= { background: #fff } }
}
I've used ~: and ~= as an example, but other symbols are possible (for example :~)
Note that with the option 2, the right hand side of this is NOT of type Style, but rather a struct type that has less fields. In particular, this would not work:
exportcomponentMyWidget {
inproperty <Style> style;
MyBase {
// This is like a normal binding since the right hand side type already have all the fields
style ~: root.style;
}
}
exportcomponentApp {
MyWidget {
// This is not working as expected since the MyWidget's style don't have a binding
style ~: { background: #fff }
}
}
For that reason I think it's best to use option 1, which might already be enough.
Check the following example:
In the example what I want for
MyWidget
is to setbackground
towhite
and leaveborder-brush
toblack
, as it is defined inMyBase
. But currently it doesn't work. What happens instead is thatbackground
is set toblack
and all not set field of the structs are set to the defaults. So in case ofborder-brush
totransparent
.The text was updated successfully, but these errors were encountered: