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