react-swipe

WebJar for react-swipe

License

License

MIT
Categories

Categories

React User Interface Web Frameworks
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

react-swipe
Last Version

Last Version

5.0.3
Release Date

Release Date

Type

Type

jar
Description

Description

react-swipe
WebJar for react-swipe
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/voronianski/react-swipe

Download react-swipe

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/react-swipe/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>react-swipe</artifactId>
    <version>5.0.3</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/react-swipe/
implementation 'org.webjars.npm:react-swipe:5.0.3'
// https://jarcasting.com/artifacts/org.webjars.npm/react-swipe/
implementation ("org.webjars.npm:react-swipe:5.0.3")
'org.webjars.npm:react-swipe:jar:5.0.3'
<dependency org="org.webjars.npm" name="react-swipe" rev="5.0.3">
  <artifact name="react-swipe" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='react-swipe', version='5.0.3')
)
libraryDependencies += "org.webjars.npm" % "react-swipe" % "5.0.3"
[org.webjars.npm/react-swipe "5.0.3"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

react-swipe

build status npm version Download Count Buy Me A Coffee

Brad Birdsall's Swipe.js as a React component.

Demo

Check out the demo from a mobile device (real or emulated).

Install

npm install react swipe-js-iso react-swipe --save

Usage

Examples

import React from 'react';
import ReactDOM from 'react-dom';
import ReactSwipe from 'react-swipe';

const Carousel = () => {
  let reactSwipeEl;

  return (
    <div>
      <ReactSwipe
        className="carousel"
        swipeOptions={{ continuous: false }}
        ref={el => (reactSwipeEl = el)}
      >
        <div>PANE 1</div>
        <div>PANE 2</div>
        <div>PANE 3</div>
      </ReactSwipe>
      <button onClick={() => reactSwipeEl.next()}>Next</button>
      <button onClick={() => reactSwipeEl.prev()}>Previous</button>
    </div>
  );
};

ReactDOM.render(<Carousel />, document.getElementById('app'));

Props

  • swipeOptions: ?Object - supports all original options from Swipe.js config. If passed object differs from the previous one react-swipe will re-initiate underlying Swipe.js instance with fresh options

  • style: ?Object - object with 3 keys (see defaults):

    • container: ?Object
    • wrapper: ?Object
    • child: ?Object
  • regular props as className, id for root component are also supported

  • childCount: ?Number - use it to explicitely tell react-swipe that it needs to re-initiate underlying Swipe.js instance. For example, by setting the childCount prop to the length of the images array that you pass into react-swipe, re-rendering will take place when the images.length differs from the previous render pass:

<ReactSwipe childCount={images.length}>{images}</ReactSwipe>

Methods

Component proxies all Swipe.js instance methods.

Playground

Configure the ReactSwipe component in a sandbox environment at CodeSandbox.


MIT Licensed

Versions

Version
5.0.3