NativeScript Basics

NativeScript Basics

NativeScript apps consist of pages that represent the separate application screens. Pages are instances of the page class of the Page module. To navigate between pages, you can use the methods of the Frame class of the Frame module.

Page management
Define page

Pages represent the separate screens of your application. Each page is an instance of the page class of the Page module. Each class instance inherits the content property which holds the root visual element of the UI.

NativeScript provides two approaches to instantiating your pages.
Create a page in XML

You can define the UI declaration and the code for the page separately.

To apply this approach, create an XML file for each page to hold the layout of the page. Thus your code will be in a JS or a TS file. The names of the XML and the JS or TS file must match.

Direct Access to Native Platform APIs and Controls
Platform-independent user interfaces are defined using XML files. NativeScript uses the XML data structures representing the cross platform abstraction to trigger platform-specific code that directly interacts with the native elements of the target operating system. This means a call to the NativeScript Button API provides a UI abstraction for Button, which directly calls UIButton on iOS or com.android.widget.Button on Android.

While application source code is written in JavaScript, TypeScript, Angular, or Vue.js, the source code is not compiled or otherwise mutated. The source code as-is runs directly on the device. This architectural choice eliminates the need for cross-compiling or transpiling. Additionally, while the application source code is written in languages commonly encountered in a browser (or in a WebView-contained mobile application) NativeScript applications run directly on the native device. There is no DOM manipulation or any mandatory browser interaction

Application Management
The application module lets you manage the life cycle of your NativeScript apps from starting the application to storing user-defined settings.

Application Run

The method run from the application module is required to start the application and accepts the path to the root XML file.

 

IT Professionals, Web Developers, web programmers, IT students can Apply for the certification course and get ahead.

Angular 4 Tutorial IndexBack to Angular 4 Tutorial Main Page

Share this post
[social_warfare]
NativeScript and Angular 4
Building Apps with NativeScript and Angular

Get industry recognized certification – Contact us

keyboard_arrow_up