O'Reilly logo

Getting Started with NativeScript by Nathanael J. Anderson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Building the main screen

We will start with the code of the application, as it is fairly simple and gives you some context for the rest of the screen. Then, we will dig into the screen Declarative UI and finish off with the CSS for the screen.

JavaScript code

The main screen code is straightforward. We need to require the same application settings as we used in the settings screen to see whether we need to make the settings screen pop up. Then, we will require the observable array, which holds all our messages. Then, we will include a file that deals with our communication, which we will discuss after the screen is done. Let's take a look at the following code snippet:

var appSettings = require('application-settings'); var ObservableArray = require("data/observable-array").ObservableArray; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required