From 347cff3ef038ab2ea5f640b115d03c161b5d8a7b Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 11 Jun 2024 23:12:16 +0800 Subject: [PATCH] fix: arrow position when placement is right again! --- src/PickerInput/Popup/index.tsx | 4 ++-- src/PickerInput/Selector/RangeSelector.tsx | 4 ++-- tests/__snapshots__/range.spec.tsx.snap | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/PickerInput/Popup/index.tsx b/src/PickerInput/Popup/index.tsx index 846866424..8d1722665 100644 --- a/src/PickerInput/Popup/index.tsx +++ b/src/PickerInput/Popup/index.tsx @@ -208,7 +208,7 @@ export default function Popup(props: PopupProps(props: PopupProps {/* Watch for container size */} diff --git a/src/PickerInput/Selector/RangeSelector.tsx b/src/PickerInput/Selector/RangeSelector.tsx index 85edf34d2..e0f7385e7 100644 --- a/src/PickerInput/Selector/RangeSelector.tsx +++ b/src/PickerInput/Selector/RangeSelector.tsx @@ -170,7 +170,8 @@ function RangeSelector( }); // ====================== ActiveBar ======================= - const offsetUnit = rtl ? 'insetInlineEnd' : 'insetInlineStart'; + const placementRight = placement?.toLowerCase().endsWith('right') || rtl; + const offsetUnit = placementRight ? 'insetInlineEnd' : 'insetInlineStart'; const [activeBarStyle, setActiveBarStyle] = React.useState({ position: 'absolute', @@ -188,7 +189,6 @@ function RangeSelector( width: offsetWidth, [offsetUnit]: offsetLeft, })); - const placementRight = placement?.toLowerCase().endsWith('right'); onActiveOffset(placementRight ? (parentWidth - offsetWidth - offsetLeft) : offsetLeft); } }); diff --git a/tests/__snapshots__/range.spec.tsx.snap b/tests/__snapshots__/range.spec.tsx.snap index ca7405946..4bd49b508 100644 --- a/tests/__snapshots__/range.spec.tsx.snap +++ b/tests/__snapshots__/range.spec.tsx.snap @@ -89,7 +89,7 @@ exports[`Picker.Range onPanelChange is array args should render correctly in pla
@@ -184,7 +184,7 @@ exports[`Picker.Range panelRender 1`] = ` >