1.1.0 • Published 5 years ago

react-native-nprogress v1.1.0

Weekly downloads
19
License
MIT
Repository
github
Last release
5 years ago

react-native-nprogress

npm version

A nanoscopic progress bar. With realistic trickle animations to tell your users that something's happening!

Completely inspired by NProgress, all credit goes back to their maintainers and contributors.

Installation

yarn add react-native-nprogress

Usage

Here is the quick how-to example:

import React, { useRef, useState } from "react";
import { NProgress } from "react-native-nprogress";

export const MyApp = () => {
  const [enabled, setEnabled] = useState(false);

  // Change `enabled` each second to mimic loader
  useEffect(() => {
    const int = setInterval(() => {
      setEnabled(e => !e);
    }, 1000);

    return () => {
      clearInterval(int);
    };
  }, []);

  return <NProgress enabled={enabled} />;
};

Props

PropTypeDefaultNote
enabledbooleanfalseStart/stop the progress bar.
heightnumber2The height in pixel of the bar.
backgroundColorstringblueThe background color of the bar.
minimumnumber0.8The minimum percentage used upon starting.
trickleSpeednumber200Adjust how often to trickle/increment, in ms.
fadeOutDurationnumber300Duration of the fade out animation.