How to create comment view?


#1

In HTML tree, we have comment, that doesn’t affect layout / paint of the document. Do we have the equivalent of comment in NativeScript View tree ? If not, may I know how to create one ?


#2

I’m not quite sure I got your question right, still HTML is basically from XML and NativeScript uses XML, so you can comment anything you want to.


#3

In the following example:

let layout = new StackLayout();
let button = new Button();
layout.addChild(button);

Instead of button, is there any subclass of View that when added to a parent via addChild, won’t have any effect on UI, while still preserving the View hierarchy ?


#4

Try using ContentView


#5

Thanks, just checked the doc :+1: