Skip to content

renderer: attaching CommentNodes to visual tree causes problems #924

Closed
@sis0k0

Description

@sis0k0

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions