From aa75d22bbaef27d5931374e125266e0ce46383a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E6=9C=BA=E5=99=A8=E4=BA=BA?= Date: Mon, 28 Jul 2025 15:21:02 +0800 Subject: [PATCH] fix: config update logic --- src/Popup/index.tsx | 2 +- tests/motion.test.jsx | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/Popup/index.tsx b/src/Popup/index.tsx index b617bb8b..37e43ce5 100644 --- a/src/Popup/index.tsx +++ b/src/Popup/index.tsx @@ -156,7 +156,7 @@ const Popup = React.forwardRef((props, ref) => { } return [mask, maskMotion, motion]; - }, [mobile]); + }, [mobile, mask, maskMotion, motion]); // ======================= Container ======================== const getPopupContainerNeedParams = getPopupContainer?.length > 0; diff --git a/tests/motion.test.jsx b/tests/motion.test.jsx index 0dd3928a..5960be60 100644 --- a/tests/motion.test.jsx +++ b/tests/motion.test.jsx @@ -140,4 +140,22 @@ describe('Trigger.Motion', () => { ); expect(document.querySelector('.little')).toBeTruthy(); }); + + it('keep motion config update when motion ready', () => { + const genTrigger = (props) => ( + } popupMotion={{}} popupVisible {...props}> + + + ); + + const { rerender } = render(genTrigger()); + expect(document.querySelector('.bamboo')).toBeFalsy(); + + rerender( + genTrigger({ + popupMotion: { motionName: 'bamboo' }, + }), + ); + expect(document.querySelector('.bamboo')).toBeTruthy(); + }); });