Skip to content

Commit

Permalink
Provide currentValue with defined value of Slider
Browse files Browse the repository at this point in the history
  • Loading branch information
BartoszKlonowski committed Oct 8, 2024
1 parent 027f600 commit 6d8ce5f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions package/src/Slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ const SliderComponent = (
...localProps
} = props;
const [currentValue, setCurrentValue] = useState(
props.value ?? props.minimumValue,
props.value || props.minimumValue || constants.SLIDER_DEFAULT_INITIAL_VALUE,
);
const [width, setWidth] = useState(0);

Expand Down Expand Up @@ -338,7 +338,7 @@ const SliderComponent = (
const SliderWithRef = React.forwardRef(SliderComponent);

SliderWithRef.defaultProps = {
value: 0,
value: constants.SLIDER_DEFAULT_INITIAL_VALUE,
minimumValue: 0,
maximumValue: 1,
step: 0,
Expand Down
1 change: 1 addition & 0 deletions package/src/utils/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export const constants = {
SLIDER_DEFAULT_INITIAL_VALUE: 0,
MARGIN_HORIZONTAL_PADDING: 0.05,
STEP_NUMBER_TEXT_FONT_SMALL: 8,
STEP_NUMBER_TEXT_FONT_BIG: 12,
Expand Down

0 comments on commit 6d8ce5f

Please sign in to comment.