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
Credits
Foreword
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Trying CSS out and styling our application


Let us open up our app.css file and make some changes. First of all, I really want a white background rather than gray. Can you guess which selector and CSS property we need to use? Your best bet is to use the Page selector; however, StackLayout would work in the current case because it also covers the entire page. The property is background-color.

Next, I would like the Tap the button message to stand out a bit more. So, let us do a couple of things. We need to modify the .title rule and reduce the margin to 10. To make the font stand out a bit more, how about we bold it and change the color to #FF0111?

Next, we really want the button to stand out. So, we will change the Button rules. First off, I like rounded corners. We need to add a border-radius of 15 to it. Since we added a radius, we need to actually define the background color to be #dddddd. We also need to tell it how wide we want the button to be to make it look sharp. I am choosing a width...