# react-native-img-with-placeholder

> Image with placeholder for ReactNative

Latest version **1.0.1** (published 2017-07-05) · ISC license · 0 weekly downloads

## Install

```sh
npm install react-native-img-with-placeholder
pnpm add react-native-img-with-placeholder
yarn add react-native-img-with-placeholder
bun add react-native-img-with-placeholder
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2017-07-05 |
| First published | 2017-07-04 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | le0zh |
| Maintainers | le0zh |
| Keywords | image, placeholder, react-native |

## Links

- npm: https://www.npmjs.com/package/react-native-img-with-placeholder
- Repository: https://github.com/le0zh/react-native-img-with-placeholder
- Homepage: https://github.com/le0zh/react-native-img-with-placeholder#readme
- Issues: https://github.com/le0zh/react-native-img-with-placeholder/issues
- npm.io page: https://npm.io/package/react-native-img-with-placeholder

## Alternatives

- [exif-parser](https://npm.io/package/exif-parser.md) — 3.8M weekly downloads
- [vite-plugin-compression](https://npm.io/package/vite-plugin-compression.md) — 569.5K weekly downloads
- [pica](https://npm.io/package/pica.md) — 442.4K weekly downloads
- [@reportportal/client-javascript](https://npm.io/package/@reportportal/client-javascript.md) — 408.8K weekly downloads
- [@tldraw/state](https://npm.io/package/@tldraw/state.md) — 316.0K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2017-07-05
- 1.0.0 — 2017-07-04

## README

# react-native-img-with-placeholder

[![npm version](https://badge.fury.io/js/react-native-img-with-placeholder.svg)](https://badge.fury.io/js/react-native-img-with-placeholder)


`react-native-img-with-placeholder`is used to display image with placeholder.

When image is loading, placeholder(aka default image) will be displayed.
After image is loaded successfullly, placeholder will be removed to reduce view count.

## Install

```
npm install react-native-img-with-placeholder --save
```

## Props

| props | type | desc |
| -- | -- | -- |
| source | ImageSource | image source  |
| placeHolderSource | number | placeholder，local image, `require('path')` |
| style? | object | image style |

### 用法

```js
import ImageWithPlaceHolder from 'react-native-img-with-placeholder';

<ImageWithPlaceHolder
  style={styles.inner}
  source={{ uri: 'http://xxxx/f190c59d6e014a97831c471777863301.jpg' }}
  placeHolderSource={require('./img/default.png')}
/>
```

----

`react-native-img-with-placeholder`控件封装了默认图片的功能。

当图片加载中或者加载失败(比如地址不正确)时，显示默认图片。
当图片加载成功时，移除默认图片。

## 安装

```
npm install react-native-img-with-placeholder --save
```

## 属性

| 属性名 | 类型 | 说明 |
| -- | -- | -- |
| source | ImageSource | 将要显示的图片源，一般是网络图片 |
| placeHolderSource | number | 默认图片，必须时本地图片，一般是通过`require('path')`得到的资源id |
| style? | object | 样式 |

### 用法

```js
import ImageWithPlaceHolder from 'react-native-img-with-placeholder';

<ImageWithPlaceHolder
  style={styles.inner}
  source={{ uri: 'http://xxxx/f190c59d6e014a97831c471777863301.jpg' }}
  placeHolderSource={require('./img/default.png')}
/>
```

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