Skip to content

Commit

Permalink
Update src/PickerTrigger/index.tsx
Browse files Browse the repository at this point in the history
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
bbb169 and coderabbitai[bot] authored Oct 26, 2024
1 parent e5f2671 commit 1f63ee9
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/PickerTrigger/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,17 @@ function PickerTrigger({
stretch="minWidth"
getPopupContainer={getPopupContainer}
onPopupAlign={(_, align) => {
Object.keys(BUILT_IN_PLACEMENTS).forEach((key) => {
if (
if (!setAlignedPlacement) return;

const matchedKey = Object.keys(BUILT_IN_PLACEMENTS).find(
(key) =>
BUILT_IN_PLACEMENTS[key].points[0] === align.points[0] &&
BUILT_IN_PLACEMENTS[key].points[1] === align.points[1]
) {
setAlignedPlacement?.(key);
}
});
);

if (matchedKey) {
setAlignedPlacement(matchedKey);
}
}}
onPopupVisibleChange={(nextVisible) => {
if (!nextVisible) {
Expand Down

0 comments on commit 1f63ee9

Please sign in to comment.