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 12, 2024
1 parent 77ac25b commit 580bfb8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
1 change: 0 additions & 1 deletion docs/examples/range.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export default () => {
value,
onChange,
onCalendarChange,
placement: 'topRight',
};

const rangePickerRef = React.useRef<PickerRef>(null);
Expand Down
5 changes: 3 additions & 2 deletions src/PickerInput/Popup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ export default function Popup<DateType extends object = any>(props: PopupProps<D
);

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

// ====================== ActiveBar =======================
const placementRight = placement?.toLowerCase().endsWith('right') || rtl;
const offsetUnit = placementRight ? 'insetInlineEnd' : 'insetInlineStart';
const placementRight = placement?.toLowerCase().endsWith('right');
const offsetUnit = rtl ? 'insetInlineEnd' : 'insetInlineStart';

const [activeBarStyle, setActiveBarStyle] = React.useState<React.CSSProperties>({
position: 'absolute',
Expand Down

0 comments on commit 580bfb8

Please sign in to comment.