# react-native-image-progress

> Progress indicator for networked images, supports progress bar and spinner

Latest version **1.2.0** (published 2022-01-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-native-image-progress
pnpm add react-native-image-progress
yarn add react-native-image-progress
bun add react-native-image-progress
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2022-01-02 |
| First published | 2015-07-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 12.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1716 |
| Author | Joel Arvidsson |
| Maintainers | oblador |
| Keywords | react-native, react-component, react-native-component, react, mobile, ios, ui, image, progress, bar, progressbar, spinner, activityindicator, loading, indicator |

## Links

- npm: https://www.npmjs.com/package/react-native-image-progress
- Repository: https://github.com/oblador/react-native-image-progress
- Issues: https://github.com/oblador/react-native-image-progress/issues
- npm.io page: https://npm.io/package/react-native-image-progress

## Dependencies (1)

- [prop-types](https://npm.io/package/prop-types.md) ^15.8.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.2.0 (latest) — 2022-01-02
- 1.1.1 — 2018-05-30
- 1.1.0 — 2018-02-24
- 1.0.1 — 2017-07-05
- 1.0.0 — 2017-07-03
- 0.6.0 — 2016-07-25
- 0.5.0 — 2016-05-24
- 0.4.0 — 2015-11-02
- 0.3.1 — 2015-10-25
- 0.3.0 — 2015-10-15
- 0.2.2 — 2015-08-07
- 0.2.1 — 2015-08-05
- 0.2.0 — 2015-07-22
- 0.1.1 — 2015-07-22
- 0.1.0 — 2015-07-20

## README

# react-native-image-progress [![Travis](https://img.shields.io/travis/oblador/react-native-image-progress.svg)](https://travis-ci.org/oblador/react-native-image-progress) [![npm version](https://img.shields.io/npm/v/react-native-image-progress.svg)](https://www.npmjs.com/package/react-native-image-progress)
*Progress indicator for networked images in React Native*

## Installation

```
yarn add react-native-image-progress
```

**Note: Progress indicators has been broken out to a separate component; [react-native-progress](https://github.com/oblador/react-native-progress). To use them, please follow installation instructions for that package.**


## Usage

```js
import Image from 'react-native-image-progress';
import ProgressBar from 'react-native-progress/Bar';
<Image 
  source={{ uri: 'http://loremflickr.com/640/480/dog' }} 
  indicator={ProgressBar} 
  style={{
    width: 320, 
    height: 240, 
  }}/>
```

## Properties

Any [`Image` property](http://facebook.github.io/react-native/docs/image.html) and the following:

| Prop | Description | Default |
|---|---|---|
|**`imageStyle`**|Styles applied to the inner image component.|*None*|
|**`indicator`**|A component to display progress, will be passed a `progress` prop with a number between 0 and 1 and `indeterminate` a boolean wether or not component has started recieveing data.|`ActivityIndicator`|
|**`indicatorProps`**|An object of props being passed to the `indicator` component. To disable indeterminate state, pass `{indeterminate: false}`.|*None*|
|**`renderIndicator(progress, indeterminate)`**|Function to render your own custom indicator, useful for something very simple. If not, consider breaking it out to a separate component and use `indicator` prop instead.|*None*|
|**`renderError(error)`**|Function to render your own custom error message or image fallback.|*None*|
|**`threshold`**|Number of milliseconds after mount to wait before displaying the indicator. Basically a workaround for cached images not to flash a spinner. Set to `0` to disable.|`50`|

Note: `onLoad*` events are bubbled up, so if you want to do some custom thing when the image is loaded for example. 

## Demo

![image-progress-demo](https://cloud.githubusercontent.com/assets/378279/10882718/0f33e7b4-813b-11e5-9f6c-90df8b9050b8.gif)

## Example 

Check full example in the `Example` folder. 

### Pie

```js
import Image from 'react-native-image-progress';
import Progress from 'react-native-progress';
<Image 
  source={{ uri: 'http://loremflickr.com/640/480/dog' }} 
  indicator={Progress.Pie}
  indicatorProps={{
    size: 80,
    borderWidth: 0,
    color: 'rgba(150, 150, 150, 1)',
    unfilledColor: 'rgba(200, 200, 200, 0.2)'
  }}
  style={{
    width: 320,
    height: 240,
  }}/>
```

## Using a custom image component

For some use cases such as better GIF support or more granular control over caching you might want to use a custom image component, to do this simply use the `createImageProgress` function: 

```js
import { createImageProgress } from 'react-native-image-progress';
import FastImage from 'react-native-fast-image';

const Image = createImageProgress(FastImage);
``` 

*NOTE: the alternative image implementation must conform to the core `Image` component life cycle props, notably `onProgress`, `onError`, `onLoad` and `onLoadStart`.*

## License

[MIT License](http://opensource.org/licenses/mit-license.html). © Joel Arvidsson

---
_Source: https://npm.io/package/react-native-image-progress · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
