Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
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.
import{LoadingIndicator,Mode,OptionsCommon,}from'@nstudio/nativescript-loading-indicator';constindicator=newLoadingIndicator();constoptions: 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 truebackgroundColor: 'yellow',userInteractionEnabled: false,// default true. Set false so that the touches will fall through it.hideBezel: true,// default false, can hide the surrounding bezelmode: Mode.AnnularDeterminate,// see options belowandroid: {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 indicatorindicator.hide();
javascript
constLoadingIndicator=require('@nstudio/nativescript-loading-indicator').LoadingIndicator;constMode=require('@nstudio/nativescript-loading-indicator').Mode;constloader=newLoadingIndicator();// optional options// android and ios have some platform specific optionsconstoptions={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 truebackgroundColor: 'yellow',userInteractionEnabled: false,// default true. Set false so that the touches will fall through it.hideBezel: true,// default false, can hide the surrounding bezelmode: Mode.AnnularDeterminate,// see options belowandroid: {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, thenloader.hide();
Common Options
exportinterfaceOptionsCommon{/** * 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
exportinterfaceOptionsAndroid{/** * 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
exportinterfaceOptionsIOS{/** * Native View instance to anchor the loading indicator to. */view?: UIView;square?: boolean;}
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.
We use optional third-party analytics cookies to understand how you use GitHub.com so we can build better products.
Learn more.
We use optional third-party analytics cookies to understand how you use GitHub.com so we can build better products.
You can always update your selection by clicking Cookie Preferences at the bottom of the page.
For more information, see our Privacy Statement.
Essential cookies
We use essential cookies to perform essential website functions, e.g. they're used to log you in.
Learn more
Always active
Analytics cookies
We use analytics cookies to understand how you use our websites so we can make them better, e.g. they're used to gather information about the pages you visit and how many clicks you need to accomplish a task.
Learn more