Skip to content

Commit

Permalink
chore: beauti offset on active change (#754)
Browse files Browse the repository at this point in the history
  • Loading branch information
zombieJ authored Feb 7, 2024
1 parent 991b988 commit 65543ed
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/PickerInput/Selector/RangeSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,7 @@ function RangeSelector<DateType extends object = any>(

const syncActiveOffset = useEvent(() => {
const input = getInput(activeIndex);
if (activeIndex === 0) {
onActiveOffset(0);
} else if (input) {
if (input) {
const { offsetWidth, offsetLeft, offsetParent } = input.nativeElement;

let offset = offsetLeft;
Expand All @@ -198,7 +196,7 @@ function RangeSelector<DateType extends object = any>(
[offsetUnit]: offset,
}));

onActiveOffset(offset);
onActiveOffset(activeIndex === 0 ? 0 : offset);
}
});

Expand Down

0 comments on commit 65543ed

Please sign in to comment.