Skip to content

Commit

Permalink
Merge pull request #28 from SimformSolutionsPvtLtd/fix/UNT-T8848
Browse files Browse the repository at this point in the history
Fix start circle issue
  • Loading branch information
mukesh-simform authored Jun 29, 2022
2 parents 64de740 + 969fb9e commit 4c796c7
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/components/RadialSlider/RadialSlider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ const RadialSlider = (props: RadialSliderProps & typeof defaultProps) => {
leftIconStyle,
rightIconStyle,
stroke,
onChange = () => {},
} = props;

const { panResponder, value, setValue, curPoint, currentRadian } =
const { panResponder, value, setValue, curPoint, currentRadian, prevValue } =
useSilderAnimation(props);

const {
Expand All @@ -74,9 +75,9 @@ const RadialSlider = (props: RadialSliderProps & typeof defaultProps) => {

const handleValue = () => {
if (iconPosition === 'up' && max > value) {
isStart && setValue((prevState: number) => prevState + step);
isStart && onPressButtons('up');
} else if (iconPosition === 'down' && min < value) {
isStart && setValue((prevState: number) => prevState - step);
isStart && onPressButtons('down');
}
};

Expand All @@ -103,9 +104,19 @@ const RadialSlider = (props: RadialSliderProps & typeof defaultProps) => {

const onPressButtons = (type: string) => {
if (type === 'up' && max > value) {
setValue((prevState: number) => prevState + step);
setValue((prevState: number) => {
prevValue.current = prevState + step;

return prevState + step;
});
onChange(value);
} else if (type === 'down' && min < value) {
setValue((prevState: number) => prevState - step);
setValue((prevState: number) => {
prevValue.current = prevState - step;

return prevState - step;
});
onChange(value);
}
};

Expand Down

0 comments on commit 4c796c7

Please sign in to comment.