From ad6f30336fa84485c8d47d0b15be2d45c21e3b62 Mon Sep 17 00:00:00 2001 From: k0r8i Date: Sun, 2 Apr 2017 14:05:06 +0200 Subject: [PATCH] Fixes Ripple event error in case props.ripple === false (#1344) --- components/ripple/Ripple.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/ripple/Ripple.js b/components/ripple/Ripple.js index 91ad7135..150a3f74 100644 --- a/components/ripple/Ripple.js +++ b/components/ripple/Ripple.js @@ -222,9 +222,11 @@ const rippleFactory = (options = {}) => { }; } + doRipple = () => (!this.props.disabled && this.props.ripple) + handleMouseDown = (event) => { if (this.props.onMouseDown) this.props.onMouseDown(event); - if (!this.props.disabled) { + if (this.doRipple()) { const { x, y } = events.getMousePosition(event); this.animateRipple(x, y, false); } @@ -232,7 +234,7 @@ const rippleFactory = (options = {}) => { handleTouchStart = (event) => { if (this.props.onTouchStart) this.props.onTouchStart(event); - if (!this.props.disabled) { + if (this.doRipple()) { const { x, y } = events.getTouchPosition(event); this.animateRipple(x, y, true); }