Skip to content

Commit cba76c7

Browse files
committed
fix: arrow place above while placement is topRight
1 parent f33f841 commit cba76c7

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/PickerInput/RangePicker.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,7 @@ function RangePicker<DateType extends object = any>(
752752
// Visible
753753
visible={mergedOpen}
754754
onClose={onPopupClose}
755+
alignedPlacement={alignedPlacement}
755756
// Range
756757
range
757758
>

src/PickerTrigger/index.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export type PickerTriggerProps = {
5454
placement?: string;
5555
builtinPlacements?: BuildInPlacements;
5656
direction?: 'ltr' | 'rtl';
57-
57+
alignedPlacement: string;
5858
// Visible
5959
visible: boolean;
6060
onClose: () => void;
@@ -72,15 +72,15 @@ function PickerTrigger({
7272
placement,
7373
builtinPlacements = BUILT_IN_PLACEMENTS,
7474
direction,
75-
75+
alignedPlacement,
7676
// Visible
7777
visible,
7878
onClose,
7979
}: PickerTriggerProps) {
8080
const { prefixCls, setAlignedPlacement } = React.useContext(PickerContext);
8181
const dropdownPrefixCls = `${prefixCls}-dropdown`;
8282

83-
const realPlacement = getRealPlacement(placement, direction === 'rtl');
83+
const realPlacement = getRealPlacement(alignedPlacement || placement, direction === 'rtl');
8484

8585
return (
8686
<Trigger
@@ -102,13 +102,13 @@ function PickerTrigger({
102102
getPopupContainer={getPopupContainer}
103103
onPopupAlign={(_, align) => {
104104
if (!setAlignedPlacement) return;
105-
105+
106106
const matchedKey = Object.keys(BUILT_IN_PLACEMENTS).find(
107107
(key) =>
108108
BUILT_IN_PLACEMENTS[key].points[0] === align.points[0] &&
109-
BUILT_IN_PLACEMENTS[key].points[1] === align.points[1]
109+
BUILT_IN_PLACEMENTS[key].points[1] === align.points[1],
110110
);
111-
111+
112112
if (matchedKey) {
113113
setAlignedPlacement(matchedKey);
114114
}

0 commit comments

Comments
 (0)