Skip to content

renderer: attaching CommentNodes to visual tree causes problems #924

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sis0k0 opened this issue Aug 1, 2017 · 0 comments · Fixed by #945
Closed

renderer: attaching CommentNodes to visual tree causes problems #924

sis0k0 opened this issue Aug 1, 2017 · 0 comments · Fixed by #945
Assignees
Labels
Milestone

Comments

@sis0k0
Copy link
Contributor

sis0k0 commented Aug 1, 2017

When ng-template is used, the Angular renderer creates comment nodes. In the context of NativeScript, these comments are invisible elements - Placeholders, which are attached to the visual tree.

Consider the following layout:

<Label text="first"></Label>

<ng-template [ngIf]="false">
    <Label text="second"></Label>
</ng-template>

Since the Page can have only child, the above will be rendered as:

(ProxyViewContainer
    (CommentNode) // anchor for the second label
    (ActionBar)
)

The first label gets overridden by the CommentNode, created for the second label. In the above case, there's an easy workaround - one can simply wrap the labels in a StackLayout. Still, there are more complicated scenarios with no easy solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants