nativescript-shimmer-enduco
TypeScript icon, indicating that this package has built-in type declarations

2.0.8 • Public • Published

NativeScript Shimmer

Facebook shimmer effect for your NativeScript app.

Uses the following native plugins:

Installation

From the command prompt go to your app's root folder and execute:

tns plugin add nativescript-shimmer-enduco

Demo

Demo

Usage

  • main-page.xml:
<Page xmlns="http://schemas.nativescript.org/tns.xsd" 
  xmlns:sh="nativescript-shimmer" 
  loaded="pageLoaded">
  <StackLayout>
    <sh:Shimmer id="shimmer">
      <Label text="Shimmer" />     
    </sh:Shimmer>
    <Button text="Toggle" tap="{{toggleShimmer}}" />
  </StackLayout>
</Page>
  • main-page.ts:
import {EventData, Observable} from "data/observable";
import {Page} from "ui/page";

// Event handler for Page "loaded" event attached in main-page.xml
export function pageLoaded(args: observable.EventData) {
    // Get the event sender
    let page = <Page>args.object;
    page.bindingContext = new ShimmerDemo(page);
}

class ShimmerDemo extends Observable {
  private _enableTxt: string;
  private _shimmer: any;

  constructor(page: Page) {
    super();
    this._shimmer = page.getViewById('shimmer');
  }

  public toggleShimmer() {
    this._shimmer.enabled = !this._shimmer.enabled;
  }
}

LICENSE

BSD

Package Sidebar

Install

npm i nativescript-shimmer-enduco

Weekly Downloads

1

Version

2.0.8

License

none

Unpacked Size

12.4 kB

Total Files

16

Last publish

Collaborators

  • staudtp93