Coder Social home page Coder Social logo

vunguyentuan / react-virtual-slider Goto Github PK

View Code? Open in Web Editor NEW
8.0 1.0 3.0 5.36 MB

Virtual Slider/Carousel for React

Home Page: https://vunguyentuan.github.io/react-virtual-slider/

License: MIT License

JavaScript 100.00%
react virtual large-dataset performance slider carousel

react-virtual-slider's Introduction

React Virtual Slider

A virtual slider for large dataset.

Join the chat at https://gitter.im/react-virtual-slider/Lobby

Travis npm package Coveralls License

GIF Demo

Features

  • Smooth animations - 60FPS dream ๐ŸŒˆ
  • Independent style - just style it as you like
  • No scrollbar - yeah, you control the slider by calling goNext, goPrev, scrollTo methods
  • Render large dataset - no matter how much your data is, it's just works

Installation

Using npm:

$ npm install react-virtual-slider --save

Or yarn:

$ yarn add react-virtual-slider

Usage:

Basic Example

import React, { Component } from 'react'
import { render } from 'react-dom'

import VirtualSlider from 'react-virtual-slider'

const styles = {
  item: {
    width: 151,
    height: 188,
    display: 'inline-block'
  },
  container: {
    overflow: 'hidden',
  }
}

class Demo extends Component {
  renderItem = (index, key) => {
    return (
      <div key={key} style={styles.item}>
        {index}
      </div>
    )
  }

  handlePrev = () => {
    this.slider.goBack()
  }

  handleNext = () => {
    this.slider.goNext()
  }

  render() {
    return (
      <div>
        <VirtualSlider
          ref={slider => this.slider = slider}
          itemRenderer={this.renderItem}
          itemSize={151}
          length={50000}
          containerStyle={styles.container}
        />

        <button onClick={this.handlePrev}>Prev</button>
        <button onClick={this.handleNext}>Next</button>
      </div>
    )
  }
}

render(<Demo/>, document.querySelector('#demo'))

That's it! Simple :D

FAQ

Running Examples

In root folder:

	$ yarn install
	$ yarn start

Dependencies

React Virtual Slider has no dependencies. It has the only one peerDependencies: react

Reporting Issues

If believe you've found an issue, please report it along with any relevant details to reproduce it.

Asking for help

Please do not use the issue tracker for personal support requests. Instead, use Gitter or StackOverflow.

Contributions

Yes please! Feature requests / pull requests are welcome.

react-virtual-slider's People

Contributors

dependabot[bot] avatar gitter-badger avatar nvtri1010 avatar vunguyentuan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

react-virtual-slider's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.