2.0.3 • Published 1 year ago

react-native-globalspinner v2.0.3

Weekly downloads
8
License
MIT
Repository
-
Last release
1 year ago

Installation

Since the library is a JS-based solution, to install the latest version of react-native-globalspinner you only need to run:

npm install --save react-native-globalspinner

or

yarn add react-native-globalspinner

Basic Usage

The Spinner component it's build to a global use, so you have to instance this component once in your main app screen always as a last inserted component:

import React from "react";
import { View } from "react-native";
import Spinner, { showSpinner, hideSpinner } from "react-native-globalspinner";

export default class App extends React.Component {
    render() {
        return (
            <View style={{ flex: 1 }}>
                <View ref={"otherView1"} />
                <View ref={"otherView2"} />
                <View ref={"otherView3"} />
                {/* GLOBAL SPINNER COMPONENT INSTANCE */}
                <Spinner type='BallIndicator' color={"blue"} size={30} count={8}/>
                {/* <--- here as last component */}
            </View>
        );
    }
}

After that you only need to call showSpinner or hideSpinner methods from anywhere in your app.

If you don't need a global use for (e.g. will use only in one screen) you can instance your Spinner Component with a ref ID (or other capture ref method):

<View style={{ flex: 1 }}>
  <YourMainApp />
  {/* <--- here as last component always with `ref` */}
  <Spinner type='BallIndicator' color={"blue"} size={30} count={8} ref="mySpinner" /> 
<View>

Props

Common properties

namedescriptiontypedefault
animationEasingAnimation easing functionFunctionEasing.linear
animationDurationAnimation duration in msNumber1200
animatingAnimation toggleBooleantrue
interactionAnimation is interactionBooleantrue

BallIndicator properties

namedescriptiontypedefault
colorComponent colorStringrgb(0, 0, 0)
countComponent countNumber8
sizeBase component sizeNumber40

BarIndicator properties

namedescriptiontypedefault
colorComponent colorStringrgb(0, 0, 0)
countComponent countNumber3
sizeBase component sizeNumber40

DotIndicator properties

namedescriptiontypedefault
colorComponent colorStringrgb(0, 0, 0)
countComponent countNumber4
sizeBase component sizeNumber16

MaterialIndicator properties

namedescriptiontypedefault
colorComponent colorStringrgb(0, 0, 0)
sizeBase component sizeNumber40

PacmanIndicator properties

namedescriptiontypedefault
colorComponent colorStringrgb(0, 0, 0)
sizeBase component sizeNumber48

PulseIndicator properties

namedescriptiontypedefault
colorComponent colorStringrgb(0, 0, 0)
sizeBase component sizeNumber40

SkypeIndicator properties

namedescriptiontypedefault
colorComponent colorStringrgb(0, 0, 0)
countComponent countNumber5
sizeBase component sizeNumber40
minScaleMinimum component scaleNumber0.2
maxScaleMaximum component scaleNumber1.0

UIActivityIndicator properties

namedescriptiontypedefault
colorComponent colorStringrgb(0, 0, 0)
countComponent countNumber12
sizeBase component sizeNumber40

WaveIndicator properties

namedescriptiontypedefault
colorComponent colorStringrgb(0, 0, 0)
countComponent countNumber4
sizeBase component sizeNumber40
waveFactorWave base numberNumber0.54
waveModeWave appearanceStringfill

Possible values for waveMode are fill and outline

Documentation

More details and usages will coming soon.

TODO

  1. Add more customization
  2. Add more spinner animations

License

MIT