How to create comment view?


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 ?


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.


In the following example:

let layout = new StackLayout();
let button = new 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 ?


Try using ContentView


Thanks, just checked the doc :+1: