Skip to content

Commit 75cac02

Browse files
authored
fix: config update logic (#560)
1 parent be890a0 commit 75cac02

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/Popup/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ const Popup = React.forwardRef<HTMLDivElement, PopupProps>((props, ref) => {
156156
}
157157

158158
return [mask, maskMotion, motion];
159-
}, [mobile]);
159+
}, [mobile, mask, maskMotion, motion]);
160160

161161
// ======================= Container ========================
162162
const getPopupContainerNeedParams = getPopupContainer?.length > 0;

tests/motion.test.jsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,4 +140,22 @@ describe('Trigger.Motion', () => {
140140
);
141141
expect(document.querySelector('.little')).toBeTruthy();
142142
});
143+
144+
it('keep motion config update when motion ready', () => {
145+
const genTrigger = (props) => (
146+
<Trigger popup={<div />} popupMotion={{}} popupVisible {...props}>
147+
<span />
148+
</Trigger>
149+
);
150+
151+
const { rerender } = render(genTrigger());
152+
expect(document.querySelector('.bamboo')).toBeFalsy();
153+
154+
rerender(
155+
genTrigger({
156+
popupMotion: { motionName: 'bamboo' },
157+
}),
158+
);
159+
expect(document.querySelector('.bamboo')).toBeTruthy();
160+
});
143161
});

0 commit comments

Comments
 (0)