From 9f285f812174e213441a15ec9545deff0a32e722 Mon Sep 17 00:00:00 2001 From: truph01 Date: Fri, 21 Jun 2024 15:45:13 +0700 Subject: [PATCH 1/2] Fix: Accordion content blinking --- Collapsible.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Collapsible.js b/Collapsible.js index 800923e..6bf691c 100644 --- a/Collapsible.js +++ b/Collapsible.js @@ -186,9 +186,12 @@ export default class Collapsible extends Component { animating, } = this.state; const hasKnownHeight = !measuring && (measured || collapsed); - const style = hasKnownHeight && { + const style = hasKnownHeight ? { overflow: 'hidden', height: height, + } : { + overflow: 'hidden', + height: 0, }; const contentStyle = {}; if (measuring) { From 13af1dd4b728d5cb9cfe190afc4c87e5c246ae96 Mon Sep 17 00:00:00 2001 From: Joel Arvidsson Date: Tue, 27 Aug 2024 21:55:48 +0200 Subject: [PATCH 2/2] Simplify style ternary --- Collapsible.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Collapsible.js b/Collapsible.js index 6bf691c..dc4d3b8 100644 --- a/Collapsible.js +++ b/Collapsible.js @@ -186,12 +186,9 @@ export default class Collapsible extends Component { animating, } = this.state; const hasKnownHeight = !measuring && (measured || collapsed); - const style = hasKnownHeight ? { + const style = { overflow: 'hidden', - height: height, - } : { - overflow: 'hidden', - height: 0, + height: hasKnownHeight ? height : 0, }; const contentStyle = {}; if (measuring) {