Add touch support for ripple

old
Javi Velasco 2015-11-19 20:13:14 +01:00 committed by Enzo Martin
parent a93ab7e997
commit bd236e172b
1 changed files with 4 additions and 4 deletions

View File

@ -25,13 +25,13 @@ class Ripple extends React.Component {
width: null
};
handleEnd = () => {
document.removeEventListener('mouseup', this.handleEnd);
handleEnd = (touch = false) => {
document.removeEventListener(touch ? 'touchend' : 'mouseup', this.handleEnd);
this.setState({active: false});
};
start = ({ pageX, pageY }) => {
document.addEventListener('mouseup', this.handleEnd);
start = ({ pageX, pageY }, touch = false) => {
document.addEventListener(touch ? 'touchend' : 'mouseup', this.handleEnd.bind(this, touch));
const {top, left, width} = this._getDescriptor(pageX, pageY);
this.setState({active: false, restarting: true, width: 0}, () => {
this.refs.ripple.offsetWidth; //eslint-disable-line no-unused-expressions