Skip to content

Commit 1f63ee9

Browse files
Update src/PickerTrigger/index.tsx
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent e5f2671 commit 1f63ee9

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/PickerTrigger/index.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,17 @@ function PickerTrigger({
101101
stretch="minWidth"
102102
getPopupContainer={getPopupContainer}
103103
onPopupAlign={(_, align) => {
104-
Object.keys(BUILT_IN_PLACEMENTS).forEach((key) => {
105-
if (
104+
if (!setAlignedPlacement) return;
105+
106+
const matchedKey = Object.keys(BUILT_IN_PLACEMENTS).find(
107+
(key) =>
106108
BUILT_IN_PLACEMENTS[key].points[0] === align.points[0] &&
107109
BUILT_IN_PLACEMENTS[key].points[1] === align.points[1]
108-
) {
109-
setAlignedPlacement?.(key);
110-
}
111-
});
110+
);
111+
112+
if (matchedKey) {
113+
setAlignedPlacement(matchedKey);
114+
}
112115
}}
113116
onPopupVisibleChange={(nextVisible) => {
114117
if (!nextVisible) {

0 commit comments

Comments
 (0)