Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does twitter bootstrap work on Nativescript runtime?

I know that nativescript used to support a subset of CSS standard. Does twitter bootstrap work on the latest Nativescript version? If not, is there any plan to make it work?

like image 918
Otabek Kholikov Avatar asked Dec 08 '22 02:12

Otabek Kholikov


2 Answers

In short: No.

Longer version: Bootstrap is a CSS framework intended for html. NativeScript is not utilizing HTML. NativeScript has its own set of UI element.

  1. There's a lot of properties in Bootstrap which isn't supported by NativeScript. Actually NativeScript only supports a very small subset of the CSS properties. This means that stuff like font-size: ..., border-radius: ..., font-weight: ..., display: ... etc wouldn't work.

  2. There's a lot of values in Bootstrap which isn't supported by NativeScript. E.g. width: 100%; wouldn't work as there's no such thing as width in percentage in NativeScript. Or width: 1170px; as there's no pixels in NativeScript.

  3. There's a lot of selectors in Bootstrap which selects HTML fields. Please remember that there are no such things as HTML fields in NativeScript. This means that all HTML selectors such as a, input, table, p etc wouldn't work. The elements simply does not exist.

There's no way of getting Bootstrap (or any other made-for-browser-framework) to work with NativeScript. Your best bet, if you like the Bootstrap look and feel is to start fresh and create your own "framework" especially for NativeScript and mimic Bootstrap as much as possible (even though you currently will not be able to get a 1 to 1 match).

like image 104
Emil Oberg Avatar answered Dec 11 '22 09:12

Emil Oberg


Although it's theoretically possible, I doubt it would work "out of the box". You can take a look here for which CSS attributes are supported.

https://github.com/NativeScript/docs/blob/master/styling.md

like image 45
dortzur Avatar answered Dec 11 '22 10:12

dortzur