npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-loading-spinner-overlay-dxc

v0.5.2

Published

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

Downloads

15

Readme

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.28.x use version >=0.3.x (0.2.x is broken, sorry!):

npm install --save react-native-loading-spinner-overlay@latest

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

npm install --save [email protected]

Usage

This usage shows the default styles and properties.

| Property | Type | Default | Description | |---------------|----------------|------------|--------------| | cancelable | boolean | false | Android: If set to false, it will prevent spinner from hiding when pressing the hardware back button. If set to true, it will allow spinner to hide if the hardware back button is pressed. | | color | string | white | Changes the spinner's color (example values are red, #ff0000, etc). For adjusting the contrast see overlayColor prop below.| | animation |none, slide, fade| none | Changes animation on show and hide spinner's view.| | overlayColor | string | rgba(0, 0, 0, 0.25) | Changes the color of the overlay.| | size | small, normal, large | large | Sets the spinner's size. No other cross-platform sizes are supported right now.| | textContent | string | "" | Optional text field to be shown.| | textStyle | style | - | The style to be applied to the <Text> that displays the textContent.| | visible | boolean | false | Controls the visibility of the spinner.|

You can also add a child view to act as a custom activity indicator.

import React, { View, Text } 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} textContent={"Loading..."} textStyle={{color: '#FFF'}} />
      </View>
    );
  }
}

To use a custom activity indicator just pass it as child of the component:

<Spinner visible={this.state.visible}>
  <Text>This is my custom spinner</Text>
</Spinner>

Platforms

For >= 0.3.x:

  • We use ActivityIndicator now!

For 0.2.x:

  • Do not use this version due to #22, use >= 0.3.x please!

For <= 0.1.x:

  • 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

For >= 0.3.x:

  • We use ActivityIndicator now!

For 0.2.x:

  • This version is broken due to a dependency issue, see issue #22

For <= 0.1.x:

  • 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. Make changes in src directory
  4. Run npm test when you're done
  5. Submit a pull request

Contributors

License

MIT