From e7e015e9a4bf54835cf3c4310a0ceab8eb5ca947 Mon Sep 17 00:00:00 2001 From: neverland Date: Tue, 2 Jul 2019 16:36:07 +0800 Subject: [PATCH] [bugfix] Collapse: use double raf to ensure animation can start (#3723) --- src/collapse-item/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/collapse-item/index.js b/src/collapse-item/index.js index 588bf8f5e..b5a0fb355 100644 --- a/src/collapse-item/index.js +++ b/src/collapse-item/index.js @@ -74,8 +74,12 @@ export default createComponent({ if (offsetHeight) { const contentHeight = `${offsetHeight}px`; wrapper.style.height = expanded ? 0 : contentHeight; + + // use double raf to ensure animation can start in mobile safari raf(() => { - wrapper.style.height = expanded ? contentHeight : 0; + raf(() => { + wrapper.style.height = expanded ? contentHeight : 0; + }); }); } else { this.onTransitionEnd();