All Projects → nstudio → nativescript-loading-indicator

nstudio / nativescript-loading-indicator

Licence: Apache-2.0 license
NativeScript Loading Indicator plugin

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
shell
77523 projects
HTML
75241 projects

Projects that are alternatives of or similar to nativescript-loading-indicator

spinnies
Node.js module to create and manage multiple spinners in command-line interface programs
Stars: ✭ 111 (+131.25%)
Mutual labels:  loading-spinner, loading-indicator
FlutterLoadingGIFs
Loading indicator GIFs. Material and Cupertino (Android and iOS) loading indicators in assorted sizes. Use as placeholders for loading remote image assets. Demo: https://gallery.codelessly.com/flutterwebsites/loadinggifs/
Stars: ✭ 28 (-41.67%)
Mutual labels:  loading-spinner, loading-indicator
SSSwiftUISpinnerButton
SSSwiftUISpinnerButton is a collection of various spinning animations for buttons in SwiftUI.
Stars: ✭ 37 (-22.92%)
Mutual labels:  loading-spinner, loading-indicator
nativescript-snackbar
NativeScript plugin for Material Design Snackbar
Stars: ✭ 22 (-54.17%)
Mutual labels:  nativescript, nstudio
nativescript-store-update
No description or website provided.
Stars: ✭ 18 (-62.5%)
Mutual labels:  nativescript
Fireloop.io
Modern Real-Time Platform by MEAN Expert
Stars: ✭ 176 (+266.67%)
Mutual labels:  nativescript
Nativescript Schematics
nativescript, mobile, schematics, angular
Stars: ✭ 176 (+266.67%)
Mutual labels:  nativescript
Nativescript Local Notifications
📫 NativeScript plugin to easily schedule local notifications
Stars: ✭ 159 (+231.25%)
Mutual labels:  nativescript
nativescript-swipe-layout
🎆
Stars: ✭ 21 (-56.25%)
Mutual labels:  nativescript
nativescript-imagepicker
Imagepicker plugin supporting both single and multiple selection.
Stars: ✭ 103 (+114.58%)
Mutual labels:  nativescript
nativescript-datetimepicker
Plugin with date and time picking fields
Stars: ✭ 26 (-45.83%)
Mutual labels:  nativescript
Nativescript Mapbox
🗽 🗼 🗻 Native OpenGL powered Maps, by Mapbox
Stars: ✭ 187 (+289.58%)
Mutual labels:  nativescript
NativeScript-Status-Bar
A simple NativeScript plugin for controlling status bar visibility.
Stars: ✭ 15 (-68.75%)
Mutual labels:  nativescript
Nativescript Pluginshowcase
An app I'm using to showcase a bunch of NativeScript plugins (also in the appstores!)
Stars: ✭ 176 (+266.67%)
Mutual labels:  nativescript
loading
Laravel package to add loading indicator to pages while page is loading.
Stars: ✭ 38 (-20.83%)
Mutual labels:  loading-spinner
Ui Material Components
Monorepo that contains all of the NativeScript Material Design plugins.
Stars: ✭ 170 (+254.17%)
Mutual labels:  nativescript
Rwa Trivia
Trivia App - Real World Angular series
Stars: ✭ 251 (+422.92%)
Mutual labels:  nativescript
respinner
Pretty and customizable svg spinners for React.js
Stars: ✭ 89 (+85.42%)
Mutual labels:  loading-spinner
React Nativescript
React renderer for NativeScript
Stars: ✭ 244 (+408.33%)
Mutual labels:  nativescript
Nativescript Google Maps Sdk
Cross Platform Google Maps SDK for Nativescript
Stars: ✭ 234 (+387.5%)
Mutual labels:  nativescript

Source management moved to nstudio/nativescript-plugins


NativeScript Loading Indicator

NativeScript-Loading-Indicator is a plugin for NativeScript which overlays a loading indicator on the current page. Can be used, for example, to prevent the UI being interacted with while data is being fetched from an API, while informing the user that something is happening.

npm npm


Installation

NativeScript 7+:

ns plugin add @nstudio/nativescript-loading-indicator

NativeScript lower than 7:

tns plugin add @nstudio/[email protected]

Screenshots

iOS

iOS iOS iOS iOS

Android

Android Android Android Android

Example

TypeScript

import {
  LoadingIndicator,
  Mode,
  OptionsCommon,
} from '@nstudio/nativescript-loading-indicator';

const indicator = new LoadingIndicator();

const options: OptionsCommon = {
  message: 'Loading...',
  details: 'Additional detail note!',
  progress: 0.65,
  margin: 10,
  dimBackground: true,
  color: '#4B9ED6', // color of indicator and labels
  // background box around indicator
  // hideBezel will override this if true
  backgroundColor: 'yellow',
  userInteractionEnabled: false, // default true. Set false so that the touches will fall through it.
  hideBezel: true, // default false, can hide the surrounding bezel
  mode: Mode.AnnularDeterminate, // see options below
  android: {
    view: someStackLayout.android, // Target view to show on top of (Defaults to entire window)
    cancelable: true,
    cancelListener: function (dialog) {
      console.log('Loading cancelled');
    },
  },
  ios: {
    view: someButton.ios, // Target view to show on top of (Defaults to entire window)
    square: false,
  },
};

indicator.show(options);

// after some async event maybe or a timeout hide the indicator
indicator.hide();

javascript

const LoadingIndicator = require('@nstudio/nativescript-loading-indicator')
  .LoadingIndicator;
const Mode = require('@nstudio/nativescript-loading-indicator').Mode;

const loader = new LoadingIndicator();

// optional options
// android and ios have some platform specific options
const options = {
  message: 'Loading...',
  details: 'Additional detail note!',
  progress: 0.65,
  margin: 10,
  dimBackground: true,
  color: '#4B9ED6', // color of indicator and labels
  // background box around indicator
  // hideBezel will override this if true
  backgroundColor: 'yellow',
  userInteractionEnabled: false, // default true. Set false so that the touches will fall through it.
  hideBezel: true, // default false, can hide the surrounding bezel
  mode: Mode.AnnularDeterminate, // see options below
  android: {
    view: android.view.View, // Target view to show on top of (Defaults to entire window)
    cancelable: true,
    cancelListener: function (dialog) {
      console.log('Loading cancelled');
    },
  },
  ios: {
    view: UIView, // Target view to show on top of (Defaults to entire window)
  },
};

loader.show(options); // options is optional

// Do whatever it is you want to do while the loader is showing, then

loader.hide();

Common Options

export interface OptionsCommon {
  /**
   * Message in the loading indicator.
   */
  message?: string;

  /**
   * Details message in the loading indicator.
   */
  details?: string;

  /**
   * Color of the message text.
   */
  color?: string;

  /**
   * Background color of the loading indicator.
   */
  backgroundColor?: string;

  /**
   * Progress of the indicator when not using CustomView or Text Mode.
   */
  progress?: number;

  /**
   * Margin for the message/indicator to the edge of the bezel.
   */
  margin?: number;

  /**
   * Set true to allow user interaction.
   */
  userInteractionEnabled?: boolean;

  /**
   * Dim the background behind the indicator.
   */
  dimBackground?: boolean;

  /**
   * Hide bezel around indicator
   */
  hideBezel?: boolean;

  /**
   * The mode of the loading indicator.
   */
  mode?: Mode;

  /**
   * If `mode` is set to CustomView, then you can pass an image or view to show in the loading indicator.
   */
  customView?: any;

  /**
   * iOS specific configuration options.
   */
  ios?: OptionsIOS;

  /**
   * Android specific configuration options.
   */
  android?: OptionsAndroid;
}

Android Specific

export interface OptionsAndroid {
  /**
   * Native View instance to anchor the loading indicator to.
   */
  view?: android.view.View;
  max?: number;
  progressNumberFormat?: string;
  progressPercentFormat?: number;
  progressStyle?: number;
  secondaryProgress?: number;
  cancelable?: boolean;
  cancelListener?: (dialog: any) => void;
  elevation?: number;
}

iOS Specific

export interface OptionsIOS {
  /**
   * Native View instance to anchor the loading indicator to.
   */
  view?: UIView;
  square?: boolean;
}

Mode Enum

export enum Mode {
  Indeterminate = 0,
  Determinate = 1,
  DeterminateHorizontalBar = 2,
  AnnularDeterminate = 3,
  CustomView = 4,
  Text = 5,
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].