Skip to content

Commit dcc8915

Browse files
committed
Merge remote-tracking branch 'origin/master' into feat/indication-for-mandatory-field
2 parents 7fcff32 + af12326 commit dcc8915

File tree

2 files changed

+45
-46
lines changed

2 files changed

+45
-46
lines changed

src/components/colorPicker/index.tsx

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

src/components/slider/index.tsx

Lines changed: 44 additions & 46 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,7 +220,8 @@ export default class Slider extends PureComponent<SliderProps, State> {
220220
});
221221
}
222222

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

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

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

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

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

484489
get disableRTL() {
485490
const {disableRTL, useRange} = this.props;
486-
if (useRange) { // block forceRTL on range slider
491+
if (useRange) {
492+
// block forceRTL on range slider
487493
return false;
488494
}
489495
return disableRTL;
@@ -552,7 +558,8 @@ export default class Slider extends PureComponent<SliderProps, State> {
552558

553559
let values = {min: this.lastMinValue, max: this.lastValue};
554560

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

696-
return (
697-
_.isFunction(renderTrack) ? (
703+
return _.isFunction(renderTrack) ? (
704+
<View style={[styles.track, {backgroundColor: maximumTrackTintColor}, trackStyle]} onLayout={this.onTrackLayout}>
705+
{renderTrack()}
706+
</View>
707+
) : (
708+
<View>
698709
<View
699-
style={[styles.track, {backgroundColor: maximumTrackTintColor}, trackStyle]}
710+
style={[
711+
styles.track,
712+
trackStyle,
713+
{
714+
backgroundColor: disabled ? INACTIVE_COLOR : maximumTrackTintColor
715+
}
716+
]}
700717
onLayout={this.onTrackLayout}
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-
)
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>
730732
);
731733
}
732734

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

0 commit comments

Comments
 (0)