Skip to content

Commit ea5e62f

Browse files
committed
Revert "Fix/colorpicker debounce (#2777)"
This reverts commit af12326.
1 parent 0e3f308 commit ea5e62f

File tree

2 files changed

+46
-45
lines changed

2 files changed

+46
-45
lines changed

src/components/colorPicker/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ class ColorPicker extends PureComponent<Props> {
124124
doneButton: accessibilityLabels?.doneButton,
125125
input: accessibilityLabels?.input
126126
}}
127-
migrate
128127
/>
129128
</View>
130129
);

src/components/slider/index.tsx

Lines changed: 46 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const INACTIVE_COLOR = Colors.$backgroundNeutralMedium;
3030
const MIN_RANGE_GAP = 4;
3131

3232
export type SliderOnValueChange = (value: number) => void;
33-
export type SliderOnRangeChange = (values: {min: number; max: number}) => void;
33+
export type SliderOnRangeChange = (values: {min: number, max: number}) => void;
3434

3535
export type SliderProps = Omit<ThumbProps, 'ref'> & {
3636
/**
@@ -142,7 +142,7 @@ type Measurements = {
142142

143143
type ThumbStyle = {style?: StyleProp<ViewStyle>; left?: StyleProp<number>};
144144

145-
type MinTrackStyle = {style?: StyleProp<ViewStyle>; width?: StyleProp<number>; left?: StyleProp<number>};
145+
type MinTrackStyle = {style?: StyleProp<ViewStyle>; width?: StyleProp<number>, left?: StyleProp<number>};
146146

147147
type MeasuredVariableName = 'containerSize' | 'trackSize' | 'thumbSize';
148148

@@ -220,8 +220,7 @@ export default class Slider extends PureComponent<SliderProps, State> {
220220
});
221221
}
222222

223-
reset() {
224-
// NOTE: used with ref
223+
reset() { // NOTE: used with ref
225224
this.lastValue = this.initialValue;
226225
this.lastMinValue = this.minInitialValue;
227226
this.lastDx = 0;
@@ -400,10 +399,8 @@ export default class Slider extends PureComponent<SliderProps, State> {
400399

401400
if (useRange) {
402401
const minThumbPosition = this._minThumbStyles?.left as number;
403-
if (
404-
(useGap && left > minThumbPosition + thumbSize.width + MIN_RANGE_GAP) ||
405-
(!useGap && left >= minThumbPosition)
406-
) {
402+
if (useGap && left > minThumbPosition + thumbSize.width + MIN_RANGE_GAP
403+
|| !useGap && left >= minThumbPosition) {
407404
this._thumbStyles.left = left;
408405

409406
const width = left - minThumbPosition;
@@ -436,10 +433,8 @@ export default class Slider extends PureComponent<SliderProps, State> {
436433
const left = trackSize.width === 0 ? _x : (_x * nonOverlappingTrackWidth) / trackSize.width; // do not render above prefix\suffix icon\text
437434

438435
const maxThumbPosition = this._thumbStyles?.left as number;
439-
if (
440-
(useGap && left < maxThumbPosition - thumbSize.width - MIN_RANGE_GAP) ||
441-
(!useGap && left <= maxThumbPosition)
442-
) {
436+
if (useGap && left < maxThumbPosition - thumbSize.width - MIN_RANGE_GAP
437+
|| !useGap && left <= maxThumbPosition) {
443438
this._minThumbStyles.left = left;
444439

445440
this._minTrackStyles.width = maxThumbPosition - x;
@@ -488,8 +483,7 @@ export default class Slider extends PureComponent<SliderProps, State> {
488483

489484
get disableRTL() {
490485
const {disableRTL, useRange} = this.props;
491-
if (useRange) {
492-
// block forceRTL on range slider
486+
if (useRange) { // block forceRTL on range slider
493487
return false;
494488
}
495489
return disableRTL;
@@ -558,8 +552,7 @@ export default class Slider extends PureComponent<SliderProps, State> {
558552

559553
let values = {min: this.lastMinValue, max: this.lastValue};
560554

561-
if (Constants.isRTL && this.props.disableRTL) {
562-
// forceRTL for range slider
555+
if (Constants.isRTL && this.props.disableRTL) { // forceRTL for range slider
563556
const {maximumValue} = this.props;
564557
values = {min: maximumValue - this.lastValue, max: maximumValue - this.lastMinValue};
565558
}
@@ -700,35 +693,40 @@ export default class Slider extends PureComponent<SliderProps, State> {
700693
maximumTrackTintColor = DEFAULT_COLOR
701694
} = this.props;
702695

703-
return _.isFunction(renderTrack) ? (
704-
<View style={[styles.track, {backgroundColor: maximumTrackTintColor}, trackStyle]} onLayout={this.onTrackLayout}>
705-
{renderTrack()}
706-
</View>
707-
) : (
708-
<View>
696+
return (
697+
_.isFunction(renderTrack) ? (
709698
<View
710-
style={[
711-
styles.track,
712-
trackStyle,
713-
{
714-
backgroundColor: disabled ? INACTIVE_COLOR : maximumTrackTintColor
715-
}
716-
]}
699+
style={[styles.track, {backgroundColor: maximumTrackTintColor}, trackStyle]}
717700
onLayout={this.onTrackLayout}
718-
/>
719-
<View
720-
ref={this.minTrack}
721-
style={[
722-
styles.track,
723-
trackStyle,
724-
styles.minimumTrack,
725-
this.shouldForceLTR && styles.trackDisableRTL,
726-
{
727-
backgroundColor: disabled ? DEFAULT_COLOR : minimumTrackTintColor
728-
}
729-
]}
730-
/>
731-
</View>
701+
>
702+
{renderTrack()}
703+
</View>
704+
) : (
705+
<View>
706+
<View
707+
style={[
708+
styles.track,
709+
trackStyle,
710+
{
711+
backgroundColor: disabled ? INACTIVE_COLOR : maximumTrackTintColor
712+
}
713+
]}
714+
onLayout={this.onTrackLayout}
715+
/>
716+
<View
717+
ref={this.minTrack}
718+
style={[
719+
styles.track,
720+
trackStyle,
721+
styles.minimumTrack,
722+
this.shouldForceLTR && styles.trackDisableRTL,
723+
{
724+
backgroundColor: disabled ? DEFAULT_COLOR : minimumTrackTintColor
725+
}
726+
]}
727+
/>
728+
</View>
729+
)
732730
);
733731
}
734732

@@ -738,7 +736,11 @@ export default class Slider extends PureComponent<SliderProps, State> {
738736
if (useGap) {
739737
return this.renderMinThumb();
740738
}
741-
return <View style={{zIndex: this.isDefaultThumbActive() ? 0 : 1, top: '-50%'}}>{this.renderMinThumb()}</View>;
739+
return (
740+
<View style={{zIndex: this.isDefaultThumbActive() ? 0 : 1, top: '-50%'}}>
741+
{this.renderMinThumb()}
742+
</View>
743+
);
742744
}
743745
}
744746

0 commit comments

Comments
 (0)