1.0.1 • Published 4 years ago

react-instagram-zoom v1.0.1

Weekly downloads
117
License
MIT
Repository
github
Last release
4 years ago

react-instagram-zoom

React component that implements Instagram-like zoom for mobile. No dependencies.

NPM JavaScript Style Guide

Install

npm install --save react-instagram-zoom

Demo

  • Open this CodeSandbox example in mobile to try it:

https://codesandbox.io/s/react-instagram-zoom-7c1wl

Usage

  • Wrap anything you want to make zoomable with <Zoomable></Zoomable> tags.
  • It can zoom in any content (not only images) that css transform can be applied to.
<Zoomable>
    <img
      src="https://github.com/AlexSapoznikov/react-instagram-zoom/blob/master/example/public/cat.png?raw=true"
      alt="Cat"
    />
</Zoomable>

Docs

PropsTypeDefaultDescription
releaseAnimationTimeoutnumber500Animation speed for restoring original size of the image when user lifts up fingers.
maxScalenumberNumber.MAX_SAFE_INTEGERMax zoom. For example value of 1 won't allow zooming in, value of 2 allows to zoom up to 100%.
zIndexnumberNumber.MAX_SAFE_INTEGERz-index that is applied when zooming in.
styleobject{}Allows to add style to Zoomable component.
classNamestringundefinedAllows to add className to Zoomable component
Events
onReleaseAnimationStartTouchEventundefinedEvent when release animation starts
onReleaseAnimationEndTouchEventundefinedEvent when release animation ends
onTouchStartTouchEventundefinedEvent when touch starts
onTouchMoveTouchEventundefinedEvent when touch is in process
onTouchEndTouchEventundefinedEvent when touch ends

License

MIT © https://github.com/AlexSapoznikov/react-instagram-zoom