From 02eeb9b16309ef26241593dacebd12e0ed09ad39 Mon Sep 17 00:00:00 2001 From: Vit Pankin Date: Sun, 5 May 2019 05:38:30 +0300 Subject: [PATCH 1/2] Stop() component increase/decrease if readOnly or disabled property was set to true --- src/NumericInput.jsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/NumericInput.jsx b/src/NumericInput.jsx index 3aee95a..f4d160c 100644 --- a/src/NumericInput.jsx +++ b/src/NumericInput.jsx @@ -460,6 +460,13 @@ class NumericInput extends Component } } + // if readOnly or disabled were just set stop() increase/decrease interval and blur() the input + // check if current readOnly or disabled are true and both previous are false + if ((this.props.readOnly || this.props.disabled) && !prevProps.readOnly && !prevProps.disabled) { + this.stop(); + this.refsInput.blur(); + } + this.checkValidity() } From a365dd1d3d4497f8dc2d1ea1e7e1a1d68f36f2a8 Mon Sep 17 00:00:00 2001 From: Vit Pankin Date: Sun, 5 May 2019 05:41:04 +0300 Subject: [PATCH 2/2] Comment upd --- src/NumericInput.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/NumericInput.jsx b/src/NumericInput.jsx index f4d160c..fd7de7c 100644 --- a/src/NumericInput.jsx +++ b/src/NumericInput.jsx @@ -460,8 +460,8 @@ class NumericInput extends Component } } - // if readOnly or disabled were just set stop() increase/decrease interval and blur() the input - // check if current readOnly or disabled are true and both previous are false + // if readOnly or disabled props were just set to true stop() increase/decrease interval and blur() the input + // check if current readOnly or disabled props are true and both previous are false if ((this.props.readOnly || this.props.disabled) && !prevProps.readOnly && !prevProps.disabled) { this.stop(); this.refsInput.blur();