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

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;
var Socket = require("./AjaxSocket.js").AJAXSocket;

Next, we will define the icon array and the message array. Each of the icon values, such as 0xE0C9, is easily accessible on the icon fonts website. We will...

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