rc-image
React easy to use image component
Last updated 4 years ago by afc163 .
MIT · Repository · Bugs · Original npm
$ cnpm install rc-image 
SYNC missed versions from official npm registry.

rc-image

React Image.

NPM version dumi CircleCI status Test coverage Dependencies DevDependencies npm download bundle size

Feature

  • [x] Placeholder
  • [x] Preview
  • [x] Rotate
  • [x] Zoom
  • [x] Fallback
  • [x] Multiple Preview

install

rc-image

Usage

npm install
npm start
const Image = require('rc-image');

ReactDOM.render(
  <Image src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" />
), document.getElementById('root'));

API

Name Type Default Description
preview boolean | {visible: boolean,onVisibleChange:function(value, prevValue),getContainer: string | HTMLElement | (() => HTMLElement) | false } true Whether to show preview
prefixCls string rc-image Classname prefix
placeholder boolean | ReactElement - if true will set default placeholder or use ReactElement set customize placeholder
fallback string - Load failed src
previewPrefixCls string rc-image-preview Preview classname prefix
onError (event: Event) => void - Load failed callback

Image.PreviewGroup

preview the merged src

const Image = require('rc-image');

ReactDOM.render(
  <Image.PreviewGroup>
    <Image src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" />
    <Image src="https://gw.alipayobjects.com/mdn/rms_08e378/afts/img/A*P0S-QIRUbsUAAAAAAAAAAABkARQnAQ" />
  </Image.PreviewGroup>
), document.getElementById('root'));

API

Name Type Default Description
preview boolean | {visible: boolean,onVisibleChange:function(value, prevValue),getContainer: string | HTMLElement | (() => HTMLElement) | false } true Whether to show preview
current number 0 If Preview the show img index

Example

http://localhost:8003/examples/

Test Case

npm test

Coverage

npm run coverage

License

rc-image is released under the MIT license.

Current Tags

  • 5.15.1                                ...           latest (3 years ago)

17 Versions

  • 5.12.2                                ...           3 years ago
  • 5.15.1                                ...           3 years ago
  • 5.13.0                                ...           3 years ago
  • 5.12.0                                ...           3 years ago
  • 5.9.0                                ...           3 years ago
  • 5.8.0                                ...           3 years ago
  • 5.7.1                                ...           3 years ago
  • 5.6.4                                ...           3 years ago
  • 5.7.0                                ...           3 years ago
  • 5.6.2                                ...           3 years ago
  • 5.6.0                                ...           3 years ago
  • 5.5.0                                ...           3 years ago
  • 5.2.5                                ...           4 years ago
  • 5.2.4                                ...           4 years ago
  • 4.1.1                                ...           5 years ago
  • 4.0.1                                ...           5 years ago
  • 3.2.2                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (4)
Dev Dependencies (20)
Dependents (0)
None

Copyright 2013 - present © cnpmjs.org