react-swipe-navigation

1.1.5 • Public • Published

react-swipe-navigation

A simple navigation system based on panels with swipe interaction for both mobile and PC made with React

Credits

Used a slightly modified version of Dmitri Voronianski's react-swipe which also uses Swipe.js itself.

Demo

Check out the demo (best fit on mobile)

gif

Install

npm install react-swipe-navigation

Usage

Example

import React from 'react'
import ReactDOM from 'react-dom';
import ReactSwipeNavigation from 'react-swipe-navigation';
 
class YourClass extends React.Component {
    render() {
        return (
            <ReactSwipeNavigation menu={ ['Home', 'Blog', 'About', 'Contact'] } >
                <div>Home content</div>
                <div>Blog content</div>
                <div>About content</div>
                <div>Contact content</div>
            </ReactSwipeNavigation>
        );
    }
}
 
ReactDOM.render(
    <YourClass />, 
    document.getElementById('app')
);

Props

  • menu: ?Array - any length, but more than 6 will not fit well on mobile
  • minX: ?Number - minimum X axis difference for valid swipe
  • maxY: ?Number - maximum Y axis difference for valid swipe
  • speed: ?Number - speed of transitions (default is Swipe.js's default, 300ms)

(See defaults)

MIT Licensed

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.1.520latest

Version History

VersionDownloads (Last 7 Days)Published
1.1.520
1.1.40
1.1.30
1.1.20
1.1.10
1.1.00
1.0.90
1.0.80
1.0.70
1.0.60
1.0.50
1.0.40
1.0.30
1.0.20
1.0.10
1.0.00

Package Sidebar

Install

npm i react-swipe-navigation

Weekly Downloads

20

Version

1.1.5

License

MIT

Last publish

Collaborators

  • enzoferey