Skip to content

Commit

Permalink
new react version adjustments in demo
Browse files Browse the repository at this point in the history
  • Loading branch information
voronianski committed Nov 21, 2018
1 parent d74ff29 commit 68bfbe4
Show file tree
Hide file tree
Showing 9 changed files with 2,340 additions and 1,550 deletions.
5 changes: 2 additions & 3 deletions .travis.yml
@@ -1,5 +1,4 @@
language: node_js
node_js:
- 4
before_script:
- npm run lint
- 10
- 8
2 changes: 1 addition & 1 deletion demo/bundle.min.js

Large diffs are not rendered by default.

18 changes: 12 additions & 6 deletions demo/index.js
@@ -1,7 +1,7 @@
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import querystring from 'querystring';
import ReactSwipe from '../src/reactSwipe';
import ReactSwipe from '../src';

const query = querystring.parse(window.location.search.slice(1));

Expand Down Expand Up @@ -32,12 +32,18 @@ const swipeOptions = {
};

class Page extends Component {
constructor(props) {
super(props);

this.reactSwipeRef = React.createRef();
}

next() {
this.reactSwipe.next();
this.reactSwipeRef.current.next();
}

prev() {
this.reactSwipe.prev();
this.reactSwipeRef.current.prev();
}

render() {
Expand All @@ -54,18 +60,18 @@ class Page extends Component {
</h2>

<ReactSwipe
ref={reactSwipe => (this.reactSwipe = reactSwipe)}
ref={this.reactSwipeRef}
className="mySwipe"
swipeOptions={swipeOptions}
>
{paneNodes}
</ReactSwipe>

<div>
<button type="button" onClick={::this.prev}>
<button type="button" onClick={() => this.prev()}>
Prev
</button>
<button type="button" onClick={::this.next}>
<button type="button" onClick={() => this.next()}>
Next
</button>
</div>
Expand Down

0 comments on commit 68bfbe4

Please sign in to comment.