diff --git a/src/components/accordion/index.tsx b/src/components/accordion/index.tsx index e822ef247..0c0442a50 100644 --- a/src/components/accordion/index.tsx +++ b/src/components/accordion/index.tsx @@ -25,7 +25,7 @@ export default class AtAccordion extends AtComponent< this.isCompleted = true this.startOpen = false this.state = { - wrapperHeight: 0 + wrapperHeight: 'unset' } } @@ -109,8 +109,9 @@ export default class AtAccordion extends AtComponent< color: (icon && icon.color) || '', fontSize: (icon && `${icon.size}px`) || '' } - const contentStyle = { height: `${wrapperHeight}px` } - + const contentStyle = { + height: wrapperHeight === 'unset' ? wrapperHeight : `${wrapperHeight}px` + } if (this.isCompleted) { contentStyle.height = '' } diff --git a/types/accordion.d.ts b/types/accordion.d.ts index 5f9d819a1..81dfc0309 100644 --- a/types/accordion.d.ts +++ b/types/accordion.d.ts @@ -40,7 +40,7 @@ export interface AtAccordionProps extends AtComponent { } export interface AtAccordionState { - wrapperHeight: number + wrapperHeight: number | 'unset' } declare const AtAccordion: ComponentClass