Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Getting Started with NativeScript

You're reading from   Getting Started with NativeScript Explore the possibility of building truly native, cross-platform mobile applications using your JavaScript skill—NativeScript!

Arrow left icon
Product type Paperback
Published in Jan 2016
Publisher
ISBN-13 9781785888656
Length 168 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Nathanael J. Anderson Nathanael J. Anderson
Author Profile Icon Nathanael J. Anderson
Nathanael J. Anderson
Arrow right icon
View More author details
Toc

Declarative UI


You have several ways to deal with platform specifics in your Declarative UI files. We will look at each way and examine the pros and cons of each method.

Declarative UI properties

The first way is for properties. You can use the following line of code:

<Button ios:text="iOS is Awesome" android:text="Android is Awesome"/>

As you can see, we prefixed the text property with a ios: or android: prefix, so on their respective platforms, they will declare that the platform is Awesome. If you only have a couple of properties to change, this is the easiest method to use and maintain. It does not allow you to change any platform-specific components though. If you have a lot of platform-specific properties or you need to use a different component on the platforms, then you will need to use Declarative UI platform qualifiers.

Declarative UI platform qualifiers

A Declarative UI platform qualifier allows you to qualify a whole group of components or properties to a specific platform like...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime