From 80485fafd4d5747e84df6a61e54416471149b3d7 Mon Sep 17 00:00:00 2001 From: himlbrand Date: Sun, 21 Jul 2019 18:39:42 +0300 Subject: [PATCH] try of bug fix --- Example/App.js | 18 +++++++++++++++++- NumericInput/NumericInput.js | 3 +-- package.json | 2 +- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Example/App.js b/Example/App.js index 06de7b9d..387a63a1 100644 --- a/Example/App.js +++ b/Example/App.js @@ -31,6 +31,7 @@ export default class App extends Component { v6: 0, v7: 0, v8: 0, + value1: 1 } this.amount = 0 } @@ -43,7 +44,22 @@ export default class App extends Component { Numeric Input Examples - + { this.setState({ value1 }); console.log(this.state.value1); }} + onLimitReached={(isMin, msg) => console.log(isMin, msg)} + totalWidth={80} + totalHeight={30} + iconSize={10} + step={1} + minValue={0} + valueType="real" + rounded editable={false} + textColor="#B0228C" + iconStyle={{ color: "white" }} + rightButtonBackgroundColor="#18c2ef" + leftButtonBackgroundColor="#ff8080" + /> this.props.minValue)) { value = (value - this.props.step).toFixed(12) value = this.props.valueType === 'real' ? parseFloat(value) : parseInt(value) - this.setState({ value, stringValue: value.toString() }) } else if (this.props.minValue !== null) { this.props.onLimitReached(false, 'Reached Minimum Value!') value = this.props.minValue - this.setState({ value, stringValue: value.toString() }) } if (value !== this.props.value) this.props.onChange && this.props.onChange(Number(value)) + this.setState({ value, stringValue: value.toString() }) } isLegalValue = (value, mReal, mInt) => value === '' || (((this.props.valueType === 'real' && mReal(value)) || (this.props.valueType !== 'real' && mInt(value))) && (this.props.maxValue === null || (parseFloat(value) <= this.props.maxValue)) && (this.props.minValue === null || (parseFloat(value) >= this.props.minValue))) diff --git a/package.json b/package.json index 0e78e143..ceaf333c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-numeric-input", - "version": "1.8.1", + "version": "1.8.2", "description": "a stylish numeric input for react native", "main": "index.js", "scripts": {