Book Image

Getting Started with NativeScript

By : Nathanael J. Anderson
Book Image

Getting Started with NativeScript

By: Nathanael J. Anderson

Overview of this book

NativeScript allows you to build a fast cross-platform application that has a native UI. NativeScript is a true cross-platform framework that generates native speed applications using the native components of the host platform, all using JavaScript. Although NativeScript allows you to build your application in JavaScript, you have full access to the host OS from your code, allowing you to easily tweak or use new platform features instantly at native code speeds. Whether you have already developed multiple applications or zero applications, this book will help you to develop your next application in a cross-platform framework quickly, saving you a massive amount of time and money. This book concisely shows you NativeScript’s built-in framework that allows you to rapidly develop a fully-working compiled cross-platform application in just a few chapters. It starts by laying the foundation of NativeScript and working through the fundamentals to create a basic shell of the application. Moving on, you’ll see how to build a full-fledged application step by step. We’ll show you how to use plugins, and how to communicate with the native OS libraries easily so that you can customize your application as if your app was created in Java or Objective C. We then deal with the issues that arise from being cross platform and compensate for the different screen sizes, screen resolutions, and device abilities. Finally, we progress to testing and deploying your app.
Table of Contents (15 chapters)
Getting Started with NativeScript
About the Author
About the Reviewer

Platform- and device-specific files

The last method to differentiate between platforms is through platform- and device-specific files. These qualifiers are applicable to JavaScript, CSS, and the Declarative UI XML files. You can prefix the extension of a file with .android or .ios, so the file is main-file.ios.js or Then, only this version of the file will be loaded on that specific platform. Once the version is loaded it allows you to have a completely custom JavaScript, CSS, or Declarative UI for each platform.

In addition to the platform qualifiers, you can also use device qualifiers such as .land for landscape or .port for portrait. For screen sizes, the qualifiers minH, min, and minWH appended with a minimum number of pixels are used as qualifiers. So, the main-page.minH300.css would require the device to have at least 300 pixels height for this CSS file to load. The . minHW400 qualifier would require that both the width and height be greater or equal to 400 pixels...