Skip to content

Commit

Permalink
fix: arrow position when placement is right again
Browse files Browse the repository at this point in the history
  • Loading branch information
afc163 committed Jun 11, 2024
1 parent 19110d2 commit 9681b96
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/PickerInput/Popup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ export default function Popup<DateType extends object = any>(props: PopupProps<D
);

if (range) {
const placementRight = placement?.toLowerCase().endsWith('right');
renderNode = (
<div
ref={wrapperRef}
Expand All @@ -217,7 +216,7 @@ export default function Popup<DateType extends object = any>(props: PopupProps<D
<div
ref={arrowRef}
className={`${prefixCls}-range-arrow`}
style={{ [rtl || placementRight ? 'right' : 'left']: activeOffset }}
style={{ [rtl ? 'right' : 'left']: activeOffset }}
/>

{/* Watch for container size */}
Expand Down
4 changes: 2 additions & 2 deletions src/PickerInput/Selector/RangeSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ function RangeSelector<DateType extends object = any>(
[offsetUnit]: offset,
}));
const placementRight = placement?.toLowerCase().endsWith('right');
const startOffset = placementRight ? parentElement?.offsetWidth : 0;
onActiveOffset(activeIndex === 0 ? startOffset : offset);
const diffOfTriggerWidthAndPanelWidth = parentElement.offsetWidth - offsetWidth;
onActiveOffset(placementRight ? offset + diffOfTriggerWidthAndPanelWidth : offset);
}
});

Expand Down

0 comments on commit 9681b96

Please sign in to comment.