From 9dee0bd4436771b1c42fd1d59d3947993a794685 Mon Sep 17 00:00:00 2001 From: Sofiya Tepikin Date: Wed, 13 Jan 2021 21:14:06 +0100 Subject: [PATCH] Block invalid input of temperature value --- components/cycle-day/temperature.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/components/cycle-day/temperature.js b/components/cycle-day/temperature.js index 653133a..d0f571b 100644 --- a/components/cycle-day/temperature.js +++ b/components/cycle-day/temperature.js @@ -50,7 +50,12 @@ class Temperature extends Component { } onChangeTemperature = (value) => { - this.setState({ value, shouldShowSuggestion: false }) + if (!Number(value)) return false + + this.setState({ + value: value.trim(), + shouldShowSuggestion: false + }) } onShowTimePicker = () => {