From 5f9746e016264f85a4c279b88abb3640edf3f7b0 Mon Sep 17 00:00:00 2001 From: Soorena Date: Tue, 24 Apr 2018 15:15:53 +0430 Subject: [PATCH] refactoring --- MultiSlider.js | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/MultiSlider.js b/MultiSlider.js index 3653498..997ee59 100755 --- a/MultiSlider.js +++ b/MultiSlider.js @@ -204,12 +204,7 @@ export default class MultiSlider extends React.Component { if (!this.props.enabledOne) { return; } - var unconfined - if (I18nManager.isRTL) { - unconfined = this.state.pastOne - gestureState.dx; - } else { - unconfined = gestureState.dx + this.state.pastOne; - } + const unconfined = I18nManager.isRTL ? this.state.pastOne - gestureState.dx : gestureState.dx + this.state.pastOne; var bottom = 0; var trueTop = this.state.positionTwo - (this.props.allowOverlap ? 0 : this.stepLength); var top = trueTop === 0 ? 0 : trueTop || this.props.sliderLength; @@ -254,12 +249,7 @@ export default class MultiSlider extends React.Component { if (!this.props.enabledTwo) { return; } - var unconfined - if (I18nManager.isRTL) { - unconfined = this.state.pastTwo - gestureState.dx; - } else { - unconfined = gestureState.dx + this.state.pastTwo; - } + const unconfined = I18nManager.isRTL ? this.state.pastTwo - gestureState.dx : gestureState.dx + this.state.pastTwo; var bottom = this.state.positionOne + (this.props.allowOverlap ? 0 : this.stepLength); var top = this.props.sliderLength; var confined = unconfined < bottom