Socket
Socket
Sign inDemoInstall

react-image-enlarger

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-image-enlarger

A medium.com style image zoom component with gesture dismissal


Version published
Maintainers
1
Created
Source

react-image-enlarger

npm package Follow on Twitter

A medium.com style image zoom component with gesture dismissal similar to that found in the iOS Photos app. Originally built for use in Sancho-UI. Try the demo here.

Features

  • Drag to dismiss
  • Optionally use a differernt enlarged image source
  • Optional loading indicator when loading the enlarged image
  • Spring based animations

Install

Install react-image-enlarger and react-gesture-responder using yarn or npm.

yarn add react-image-enlarger react-gesture-responder

Usage

import Image from "react-image-enlarger";

function SingleSource() {
  const [zoomed, setZoomed] = React.useState(false);

  return (
    <Image
      style={{ width: "200px", height: "auto" }}
      zoomed={zoomed}
      src="my-image.jpg"
      alt="The best dog ever"
      onClick={() => setZoomed(true)}
      onRequestClose={() => setZoomed(false)}
    />
  );
}

API

Any additional props beyond the ones listed below are passed to the thumbnail image.

NameTypeDefault ValueDescription
zoomed*booleanWhether the enlarged image is shown
onRequestClose*() => void;A callback for closing the zoomed image
renderLoadingReact.ReactNodeRender a loading indicator
src*StringThe thumbnail image source (and enlarged, if not provided)
enlargedSrcStringAn optional larger image source

License

MIT

FAQs

Package last updated on 02 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc