"The @children placeholder cannot appear in a conditional element" why? #8616
Unanswered
Antonio225t
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Because if you have something like so: YourComponent {
inner-rect := Rectangle {
img := Image { ... }
}
}
TouchArea {
width: img.width;
clicked=> { inner-rect.background = Colors.blue; }
} Then it's not clear at the call site that inner-rect may be in a conditional or repeated, and then you can't take id from it. (the reference on the TouchArea will not work) But we could allow @children there and then have an error in the call site when this happens. (I think we alrady made the same mistake with PopupWindow) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Why this restriction?
Is there an alternative that I can use?
Beta Was this translation helpful? Give feedback.
All reactions