@@ -5,10 +5,11 @@ import {Style} from "./style";
55import { debounce , isNumeric , isEmpty , isStringEmpty } from "./utils" ;
66
77/**
8- * Default Color
9- * @type {string }
8+ * Default constants
109 */
1110const defaultColor = "#3E525F" ;
11+ const defaultLongPressStartTimeout = 1000 ;
12+ const defaultLongPressTimeout = 200 ;
1213
1314/**
1415 * Input Spinner
@@ -19,10 +20,6 @@ class InputSpinner extends Component {
1920 increaseTimer = null ;
2021 decreaseTimer = null ;
2122
22- // Press trigger timeouts
23- pressStartTriggerTimeout = 1000 ;
24- pressTriggerTimeout = 200 ;
25-
2623 /**
2724 * Constructor
2825 * @param props
@@ -290,9 +287,9 @@ class InputSpinner extends Component {
290287 }
291288 }
292289
293- let wait = this . pressTriggerTimeout ;
290+ let wait = this . props . onLongPressTimeout ;
294291 if ( this . increaseTimer === null ) {
295- wait = this . pressStartTriggerTimeout ;
292+ wait = this . props . onLongPressStartTimeout ;
296293 }
297294
298295 this . increaseTimer = setTimeout ( this . increase , wait ) ;
@@ -318,9 +315,9 @@ class InputSpinner extends Component {
318315 }
319316 }
320317
321- let wait = this . pressTriggerTimeout ;
318+ let wait = this . props . onLongPressTimeout ;
322319 if ( this . increaseTimer === null ) {
323- wait = this . pressStartTriggerTimeout ;
320+ wait = this . props . onLongPressStartTimeout ;
324321 }
325322
326323 this . decreaseTimer = setTimeout ( this . decrease , wait ) ;
@@ -894,6 +891,8 @@ InputSpinner.propTypes = {
894891 onIncrease : PropTypes . func ,
895892 onDecrease : PropTypes . func ,
896893 onSubmit : PropTypes . func ,
894+ onLongPressStartTimeout : PropTypes . number ,
895+ onLongPressTimeout : PropTypes . number ,
897896 buttonLeftDisabled : PropTypes . bool ,
898897 buttonRightDisabled : PropTypes . bool ,
899898 buttonLeftText : PropTypes . string ,
@@ -949,6 +948,8 @@ InputSpinner.defaultProps = {
949948 returnKeyType : null ,
950949 width : 150 ,
951950 height : 50 ,
951+ onLongPressStartTimeout : defaultLongPressStartTimeout ,
952+ onLongPressTimeout : defaultLongPressTimeout ,
952953 buttonLeftDisabled : false ,
953954 buttonRightDisabled : false ,
954955 buttonLeftText : null ,
0 commit comments