1.2.1 • Published 5 years ago

@zzwing/react-image v1.2.1

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

A React Image Component

CircleCI codecov

DEMO

Edit v3r46pjql0

Image

  • Auto show the loading or error status of img
  • Can be previewed by Component Preview
  • Group by props group
  • Loadable by used IntersectionObserver
PropsDescTypeDefault
style--Object
className--String
width--Number, String100
height--Number, Stringinitial
src--String
onClick--Function
maskmask style when img hoverBooleantrue
groupgroupId, used to preview image in same groupStringdefault
objectFitimg object-fit styleStringcover
imgPropsimg propsObject
previewcan be previewedBooleantrue
onDeletedelete icon callbackFunction
onErrorimg onerror callbackFunction
onLoadimg onload callbackFunction

Example

<Image src='1.jpg'/>
<Image src='1.jpg' style={{margin: '10px'}}/>
<Image src='1.jpg' width='120' height='120'/>
<Image src='1.jpg' objectFit='contains'/>
<Image src='1.jpg' imgProps={{alt: 'test', className: 'my-img-class'}}/>
<Image src='1.jpg' group='my-img-group-1'/> // PreviewApi/preview('1.jpg', [ /* group-img-list */ ])

PreviewApi

FuncDescParams
previewpreview a imageimage: imgSrc or image index of list, list:Array: Images List
showopen the previewer
hideclose the previewer
destroydestroy the ins

Demo

preview a single image

PreviewApi.preview('1.jpg')

preivew an image in list

const list = ['1.jpg', '2.jpg', '3.jpg']
// use index
PreviewApi.preview(2, list)
// or use src
PreviewApi.preview('2.jpg', list)
1.2.1

5 years ago

1.2.0

5 years ago

1.1.7

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.2

5 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.2.0

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago