1.0.6 • Published 6 years ago

nativescript-loading-screen v1.0.6

Weekly downloads
4
License
Apache-2.0
Repository
-
Last release
6 years ago

Nativescript Loading Screen apple android

This is my first plugin so please be kind :) :P

This plugin add a loading screen to both iOs and Android Apps.

Installation

tns plugin add nativescript-loading-screen

Usage

import { Observable } from 'tns-core-modules/data/observable';
import { LoadingScreen } from 'nativescript-loading-screen';

export class HelloWorldModel extends Observable {
  private loadingScreen: LoadingScreen;

  constructor() {
    super();
  }

  public showLoading() {
    this.loadingScreen = new LoadingScreen();

    this.loadingScreen.show({
      title: "test",
      message: "loading..."
    });

    setTimeout(() => {
      this.loadingScreen.updateMessage("Loading Change");
    }, 5000);

    setTimeout(() => {
      this.loadingScreen.close();
      const topmost = frameModule.topmost();
      topmost.navigate("details-page");
    }, 10000);

  }
}

If you plan to nativate after closing the loading screen you must do it in the resolved promise on iOS. See example below

  this.loadingScreen.close().then((result) => {
    console.log(`Result => ${result}`);

  });

API

MethodReturnDescription
show(options?: Options)Promise<bool>shows the loading screen
update(options?: Options)Promise<bool>updates the message & title
updateMessage(message: string)Promise<bool>updates the message
updateTitle(title: string)Promise<bool>updates the title
close()Promise<bool>closes the loading screen

Options

PropertyTypeDefaultDescription
titlestring[blank]title used for the loading screen
messagestringloading...message using for the loading screen

License

Apache License Version 2.0, January 2004

Credit

I got the idea to make this plugin from nativescript-dialog written by Vladimir Enchev @enchev

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago