Drawing simple shapes

ios
android

#1

Hi, guys! Is there a way to create primitives? For instance, if I want to create a white rectangle (like a DIV), how should I do? Do I have to create a blank Label and set its width and height via CSS?

I see that NS has a lot of components available out of the box but I want the freedom to place simple shapes for design purpose. Is it possible?

Thanks!


#2

You may use ContentView, assign width and height via CSS. If you want something more than Rectangle, more of circle, ellipse, and polygon then set clip-path using CSS that brings you most shapes you may want.


#3

That’s great! Thanks for answering.

I’ve found this high-level reference: https://docs.nativescript.org/api-reference/classes/ui_content_view.contentview

Is there any Playground example (or example of using it with Vue)?


#4

I’ve found an example:

<ContentView id="myView" width="100px" height="100px" >

Thank you so much for the help :slight_smile: