From d0f18dc1b5cc7e1710c2bd94e6d9e65d5564e0d6 Mon Sep 17 00:00:00 2001 From: Rushan Date: Thu, 15 Jun 2017 06:04:11 +0530 Subject: [PATCH] browser: Use custom input number step-up/down function (#4524) --- browser/app/js/components/Browse.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/browser/app/js/components/Browse.js b/browser/app/js/components/Browse.js index df54cf34c..15d1d508c 100644 --- a/browser/app/js/components/Browse.js +++ b/browser/app/js/components/Browse.js @@ -370,8 +370,24 @@ export default class Browse extends React.Component { } handleExpireValue(targetInput, inc, object) { - inc === -1 ? this.refs[targetInput].stepDown(1) : this.refs[targetInput].stepUp(1) + let value = this.refs[targetInput].value + let maxValue = (targetInput == 'expireHours') ? 23 : (targetInput == 'expireMins') ? 59 : (targetInput == 'expireDays') ? 7 : 0 + value = isNaN(value) ? 0 : value + // Use custom step count to support browser Edge + if((inc === -1)) { + if(value != 0) { + value-- + } + } + else { + if(value != maxValue) { + value++ + } + } + this.refs[targetInput].value = value + + // Reset hours and mins when days reaches it's max value if (this.refs.expireDays.value == 7) { this.refs.expireHours.value = 0 this.refs.expireMins.value = 0 @@ -379,6 +395,7 @@ export default class Browse extends React.Component { if (this.refs.expireDays.value + this.refs.expireHours.value + this.refs.expireMins.value == 0) { this.refs.expireDays.value = 7 } + const {dispatch} = this.props dispatch(actions.shareObject(object, this.refs.expireDays.value, this.refs.expireHours.value, this.refs.expireMins.value)) }