Skip to content

Commit aee15e5

Browse files
committed
chore: re-align when target changed
1 parent 3597803 commit aee15e5

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/UniqueProvider/index.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ export interface UniqueProviderProps {
2222
postTriggerProps?: (options: UniqueShowOptions) => UniqueShowOptions;
2323
}
2424

25-
const UniqueProvider = ({ children, postTriggerProps }: UniqueProviderProps) => {
25+
const UniqueProvider = ({
26+
children,
27+
postTriggerProps,
28+
}: UniqueProviderProps) => {
2629
const [trigger, open, options, onTargetVisibleChanged] = useTargetState();
2730

2831
// ========================== Options ===========================
@@ -144,6 +147,11 @@ const UniqueProvider = ({ children, postTriggerProps }: UniqueProviderProps) =>
144147
[],
145148
);
146149

150+
// =========================== Align ============================
151+
React.useEffect(() => {
152+
onAlign();
153+
}, [mergedOptions?.target]);
154+
147155
// =========================== Motion ===========================
148156
const onPrepare = useEvent(() => {
149157
onAlign();

0 commit comments

Comments
 (0)