@@ -35,10 +35,8 @@ class InputSpinner extends Component {
35
35
spinnerStep = 1 ;
36
36
}
37
37
38
- const min =
39
- this . props . min != null ? this . parseNum ( this . props . min ) : null ;
40
- const max =
41
- this . props . max != null ? this . parseNum ( this . props . max ) : null ;
38
+ const min = this . props . min != null ? this . parseNum ( this . props . min ) : null ;
39
+ const max = this . props . max != null ? this . parseNum ( this . props . max ) : null ;
42
40
43
41
let initialValue =
44
42
this . props . initialValue != null && ! isNaN ( 12 )
@@ -72,19 +70,13 @@ class InputSpinner extends Component {
72
70
// Parse Min
73
71
if ( this . props . min !== prevProps . min ) {
74
72
this . setState ( {
75
- min :
76
- this . props . min != null
77
- ? this . parseNum ( this . props . min )
78
- : null ,
73
+ min : this . props . min != null ? this . parseNum ( this . props . min ) : null ,
79
74
} ) ;
80
75
}
81
76
// Parse Max
82
77
if ( this . props . max !== prevProps . max ) {
83
78
this . setState ( {
84
- max :
85
- this . props . max != null
86
- ? this . parseNum ( this . props . max )
87
- : null ,
79
+ max : this . props . max != null ? this . parseNum ( this . props . max ) : null ,
88
80
} ) ;
89
81
}
90
82
// Parse Step
@@ -198,10 +190,8 @@ class InputSpinner extends Component {
198
190
*/
199
191
parseNum ( num ) {
200
192
num = String ( num ) . replace (
201
- ! isEmpty ( this . props . decimalSeparator )
202
- ? this . props . decimalSeparator
203
- : "." ,
204
- "."
193
+ ! isEmpty ( this . props . decimalSeparator ) ? this . props . decimalSeparator : "." ,
194
+ "." ,
205
195
) ;
206
196
if ( this . typeDecimal ( ) ) {
207
197
num = parseFloat ( num ) ;
@@ -226,9 +216,7 @@ class InputSpinner extends Component {
226
216
value = this . parseNum ( value ) . toFixed ( 1 ) . replace ( / 0 + $ / , "" ) ;
227
217
} else if ( this . typeDecimal ( ) ) {
228
218
value = String (
229
- this . parseNum (
230
- this . parseNum ( value ) . toFixed ( this . props . precision )
231
- )
219
+ this . parseNum ( this . parseNum ( value ) . toFixed ( this . props . precision ) ) ,
232
220
) ;
233
221
} else {
234
222
value = String ( this . parseNum ( value ) ) ;
@@ -240,7 +228,7 @@ class InputSpinner extends Component {
240
228
"." ,
241
229
! isEmpty ( this . props . decimalSeparator )
242
230
? this . props . decimalSeparator
243
- : "."
231
+ : "." ,
244
232
) ;
245
233
}
246
234
@@ -284,8 +272,7 @@ class InputSpinner extends Component {
284
272
*/
285
273
increase ( ) {
286
274
if ( this . _isDisabledButtonRight ( ) ) return ;
287
- let num =
288
- this . parseNum ( this . state . value ) + this . parseNum ( this . state . step ) ;
275
+ let num = this . parseNum ( this . state . value ) + this . parseNum ( this . state . step ) ;
289
276
if ( this . props . onIncrease ) {
290
277
let increased_num = num ;
291
278
if ( this . maxReached ( num ) ) {
@@ -308,8 +295,7 @@ class InputSpinner extends Component {
308
295
*/
309
296
decrease ( ) {
310
297
if ( this . _isDisabledButtonLeft ( ) ) return ;
311
- let num =
312
- this . parseNum ( this . state . value ) - this . parseNum ( this . state . step ) ;
298
+ let num = this . parseNum ( this . state . value ) - this . parseNum ( this . state . step ) ;
313
299
if ( this . props . onDecrease ) {
314
300
let decreased_num = num ;
315
301
if ( this . minReached ( num ) ) {
@@ -564,9 +550,7 @@ class InputSpinner extends Component {
564
550
*/
565
551
_getColorLeftButton ( ) {
566
552
const color = this . _getColor ( ) ;
567
- return this . props . colorLeft !== defaultColor
568
- ? this . props . colorLeft
569
- : color ;
553
+ return this . props . colorLeft !== defaultColor ? this . props . colorLeft : color ;
570
554
}
571
555
572
556
/**
@@ -590,9 +574,7 @@ class InputSpinner extends Component {
590
574
return [
591
575
Style . container ,
592
576
{
593
- borderColor : this . props . showBorder
594
- ? this . _getColor ( )
595
- : "transparent" ,
577
+ borderColor : this . props . showBorder ? this . _getColor ( ) : "transparent" ,
596
578
width : this . props . width ,
597
579
} ,
598
580
this . props . style ,
@@ -611,9 +593,7 @@ class InputSpinner extends Component {
611
593
color : this . props . textColor ,
612
594
fontSize : this . props . fontSize ,
613
595
fontFamily : this . props . fontFamily ,
614
- borderColor : this . props . showBorder
615
- ? this . _getColor ( )
616
- : "transparent" ,
596
+ borderColor : this . props . showBorder ? this . _getColor ( ) : "transparent" ,
617
597
backgroundColor : this . props . background ,
618
598
height : this . props . height ,
619
599
} ,
@@ -702,10 +682,7 @@ class InputSpinner extends Component {
702
682
_renderLeftButtonElement ( ) {
703
683
if ( this . props . buttonLeftImage ) {
704
684
return this . props . buttonLeftImage ;
705
- } else if (
706
- this . _isLeftButtonPressed ( ) &&
707
- this . props . buttonPressLeftImage
708
- ) {
685
+ } else if ( this . _isLeftButtonPressed ( ) && this . props . buttonPressLeftImage ) {
709
686
return this . props . buttonPressLeftImage ;
710
687
} else {
711
688
const text =
@@ -820,9 +797,7 @@ class InputSpinner extends Component {
820
797
*/
821
798
render ( ) {
822
799
return (
823
- < View
824
- style = { this . _getContainerStyle ( ) }
825
- { ...this . props . containerProps } >
800
+ < View style = { this . _getContainerStyle ( ) } { ...this . props . containerProps } >
826
801
{ this . _renderLeftButton ( ) }
827
802
828
803
{ this . props . prepend }
0 commit comments