Giter Site home page Giter Site logo

larryranches / react-native-loading-spinner-overlay Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ladjs/react-native-loading-spinner-overlay

0.0 1.0 0.0 150 KB

:barber: The only pure React Native, Native iOS and Android loading spinner (progress bar indicator) overlay

License: MIT License

JavaScript 100.00%

react-native-loading-spinner-overlay's Introduction

React Native Loading Spinner Overlay

NPM version NPM downloads MIT License

tldr; The only pure React Native Native iOS and Android loading spinner (progress bar indicator) overlay

Demo

Index

Install

For React Native version <=0.27.x use version 0.1.x:

npm install --save [email protected]

For React Native version >=0.28.x use version 0.2.x:

npm install --save [email protected]

Usage

This usage shows the default styles and properties.

  • You can pass a String size prop that can either be "large" or "small" (no other cross-platform sizes are supported right now, and by default it is "large")
  • You can pass a String color ColorProp (e.g. red or #ff0000) to change the default spinner color (by default it is "white" for high contrast on the default overlayColor; see below)
  • You can control visibility of the spinner using the Boolean prop visible (Boolean, by default it is false)
  • To change the color of the overlay, pass a ColorProp as the overlayColor prop (e.g. 'rgba(0,0,0,0.25)')
import React, { View } from 'react-native';

import Spinner from 'react-native-loading-spinner-overlay';

class MyComponent extends React.Component {

  constructor(props) {
    super();
    this.state = {
      visible: false
    };
  }

  /* eslint react/no-did-mount-set-state: 0 */
  componentDidMount() {
    setInterval(() => {
      this.setState({
        visible: !this.state.visible
      });
    }, 3000);
  }

  render() {
    return (
      <View style={{ flex: 1 }}>
        <Spinner visible={this.state.visible} />
      </View>
    );
  }
}

Platforms

  • iOS: this platform uses Modal (docs/source) to overlay and ActivityIndicatorIOS (docs) for the loading spinner
  • Android: this platform uses Portal (source) to overlay and ActivityIndicator (docs) for the loading spinner

Notes

  • Docs don't exist yet for Portal, see this issue on GitHub; once those are in, then we can add a link to the source in Platforms
  • Until a release of React Native is shipped for this pull request, Android's ProgressBarAndroid will not have support for a StyleAttr value of "Normal" - therefore we only support a size prop of "small" or "large" right now (defaulting to "large") - in other words, we can only support Android's inverse styling with a styleAttr of "Inverse", "SmallInverse" (for a size prop of "small"), and "LargeInverse" (for a size prop of "large") (since there is no "Normal" support right now for "size" of "normal").

Development

  1. Fork/clone this repository
  2. Run npm install
  3. Run npm run watch to watch the src directory for changes
  4. Make changes in src directory
  5. Run npm test when you're done
  6. Submit a pull request

Contributors

License

MIT

react-native-loading-spinner-overlay's People

Contributors

agrass avatar darrencamp avatar ivpusic avatar jeiwan avatar mlabrum avatar niftylettuce avatar rajkissu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.