Skip to content

Commit e551d12

Browse files
committed
fix: avtive bar will be wrong position while init
1 parent 18d41e0 commit e551d12

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/PickerInput/Selector/RangeSelector.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ function RangeSelector<DateType extends object = any>(
187187
const { offsetWidth, offsetLeft, offsetParent } = input.nativeElement;
188188
const parentWidth = (offsetParent as HTMLElement)?.offsetWidth || 0;
189189
const activeOffset = placementRight ? parentWidth - offsetWidth - offsetLeft : offsetLeft;
190-
setActiveBarStyle((ori) => ({
191-
...ori,
190+
setActiveBarStyle(({ position }) => ({
191+
position,
192192
width: offsetWidth,
193193
[offsetUnit]: activeOffset,
194194
}));
@@ -198,7 +198,7 @@ function RangeSelector<DateType extends object = any>(
198198

199199
React.useEffect(() => {
200200
syncActiveOffset();
201-
}, [activeIndex]);
201+
}, [activeIndex, alignedPlacement]);
202202

203203
// ======================== Clear =========================
204204
const showClear = clearIcon && ((value[0] && !disabled[0]) || (value[1] && !disabled[1]));

0 commit comments

Comments
 (0)