Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions generatedTypes/components/slider/GradientSlider.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ declare type GradientSliderComponentProps = {
} & GradientSliderProps & typeof defaultProps;
interface GradientSliderState {
color: tinycolor.ColorFormats.HSLA;
initialColor: tinycolor.ColorFormats.HSLA;
prevColor: string | undefined;
}
declare const defaultProps: {
Expand Down
9 changes: 6 additions & 3 deletions src/components/slider/GradientSlider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ type GradientSliderComponentProps = {

interface GradientSliderState {
color: tinycolor.ColorFormats.HSLA;
initialColor: tinycolor.ColorFormats.HSLA;
prevColor: string | undefined;
}

Expand All @@ -85,6 +86,7 @@ class GradientSlider extends Component<GradientSliderComponentProps, GradientSli

this.state = {
prevColor: props.color,
initialColor: Colors.getHSL(props.color),
color: Colors.getHSL(props.color)
};
}
Expand Down Expand Up @@ -186,6 +188,7 @@ class GradientSlider extends Component<GradientSliderComponentProps, GradientSli

render() {
const {type, containerStyle, disabled, accessible} = this.props;
const initialColor = this.state.initialColor;
const color = this.getColor();
const thumbTintColor = Colors.getHexString(color);
let step = 0.01;
Expand All @@ -198,17 +201,17 @@ class GradientSlider extends Component<GradientSliderComponentProps, GradientSli
case GradientSliderTypes.HUE:
step = 1;
maximumValue = 359;
value = color.h;
value = initialColor.h;
renderTrack = this.renderHueGradient;
onValueChange = this.updateHue;
break;
case GradientSliderTypes.LIGHTNESS:
value = color.l;
value = initialColor.l;
renderTrack = this.renderLightnessGradient;
onValueChange = this.updateLightness;
break;
case GradientSliderTypes.SATURATION:
value = color.s;
value = initialColor.s;
renderTrack = this.renderSaturationGradient;
onValueChange = this.updateSaturation;
break;
Expand Down