Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-imageslides

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-imageslides

A mobile friendly images viewer react component

  • 3.0.0-beta.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
60
decreased by-29.41%
Maintainers
1
Weekly downloads
 
Created
Source

React Image Viewer

version

React-slides@3 has been rewriten with React Hooks and all apis of it have been redesigned. If you are using React-slides@2, please read api docs carefully.

Example

demo

Edit focused-resonance-oxzgn

Features

  • Support multi-touch and mouse gestures (powered by Alloyfinger)
  • High performance(no unneccessary rendering)

Get Started

  1. Run yarn add react-imageslides react react-dom alloyfinger

    The package has peer dependencies on react@^17.0.0, react-dom@^17.0.0, and alloyfinger.

  2. Render it!

import React, { useState, useCallback } from 'react';
import ReactDOM from 'react-dom';
import Gallery from 'react-imageslides';
import 'react-imageslides/lib/index.css';

const images = [
  'http://dingyue.nosdn.127.net/0UDLpU6BsCNm9v9OpT0Dhn=nHKJFC6SMByz8bMWxFM=1t1531988836046compressflag.jpeg',
  'http://dingyue.nosdn.127.net/9sFTTWDQoHjxyIkU9wzm8CiDNVbq48Mwf2hyhgRghxA5O1527909480497compressflag.jpeg',
  'http://dingyue.nosdn.127.net/eSJPDtcP9NBvEOIMPyPLxwpJSZIu4D36qDss2RGQjNHBp1531990042001compressflag.jpeg',
  'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1503235534249&di=4c198d5a305627d12e5dae4c581c9e57&imgtype=0&src=http%3A%2F%2Fimg2.niutuku.com%2Fdesk%2Fanime%2F0529%2F0529-17277.jpg',
];
export default function App() {
  const [activeIndex, setActiveIndex] = useState(0);

  const handleChange = useCallback(newIndex => {
    setActiveIndex(newIndex);
  }, []);
  return <Gallery isOpen images={images} index={activeIndex} onChange={handleChange} />;
}
ReactDOM.render(<App />, document.getElementById('root'));

Apis

PropertyTypeRequiredDescription
imagesarrayyesImage urls to display
onChangefuncyesCallback fired when the index changes
isOpenboolyesWhether the component is open
indexnumberyesIndex of the first image to display
loadingIconnodePlaceholder when image is loading
onClickfuncCallback fired when user clicks gallery
onKeyPressfuncCallback fired when user press down any key
onSingleTapfuncCallback fired when user taps gallery
imageRendererfuncRender prop to custom image element

Keywords

FAQs

Package last updated on 31 Jul 2021

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