From bab2dd8f0178d643c6dcefdd4b057b3e7ebefd07 Mon Sep 17 00:00:00 2001 From: Naren Salem Date: Thu, 6 Jul 2017 12:05:40 -0500 Subject: [PATCH 1/3] Added support to specify the increment and decrement characters and also to supply a suffix --- index.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 4c66459..b4f75e2 100644 --- a/index.js +++ b/index.js @@ -24,7 +24,10 @@ var Spinner = React.createClass({ buttonTextColor: PropTypes.string, disabled: PropTypes.bool, width: PropTypes.number, - height: PropTypes.number + height: PropTypes.number, + incChar: PropTypes.string, + decChar: PropTypes.string, + suffix: PropTypes.string }, getDefaultProps () { @@ -41,7 +44,10 @@ var Spinner = React.createClass({ buttonTextColor: 'white', disabled: false, width: 90, - height: 30 + height: 30, + incChar: '+', + decChar: '-', + suffix: '' } }, @@ -117,12 +123,12 @@ var Spinner = React.createClass({ { height: this.props.height } ]} onPress={this._decrease}> - + { color: this.props.buttonTextColor, fontSize: this.props.btnFontSize }]}>{this.props.decChar} - {this.state.num} + {this.state.num}{this.props.suffix} + + }]}>{this.props.decChar} ) From 8cc085cef83a13a90cbd804678e9c3fffad12747 Mon Sep 17 00:00:00 2001 From: Naren Salem Date: Thu, 6 Jul 2017 12:13:50 -0500 Subject: [PATCH 2/3] Fixed the prop used for the increment character --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index b4f75e2..ca9792d 100644 --- a/index.js +++ b/index.js @@ -138,7 +138,7 @@ var Spinner = React.createClass({ onPress={this._increase}> {this.props.decChar} + }]}>{this.props.incChar} ) From 23096ffcb90638480c153b3f09af05bd84c0a364 Mon Sep 17 00:00:00 2001 From: Naren Salem Date: Fri, 7 Jul 2017 11:17:36 -0500 Subject: [PATCH 3/3] Updated readme with the new options - decChar, incChar, suffix --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index ce46a69..1efb3b2 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,9 @@ btnFontSize | custom fontSize of buttons in the Spinner | number | 14 | buttonTextColor | custom color of the button in the Spinner | string | 'white' | width | custom width of the Spinner | number | 90 | height | custom height of the Spinner | number | 30 | +decChar | custom character to use for the decrement button | string | '-' | +incChar | custom character to use for the increment button | string | '+' | +suffix | suffix string added after the number. For example F for Farenheit | string | '' | ## Screenshot