Skip to content

Commit

Permalink
fix: Fixed a bug that did not animate when using firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
im36-123 committed Nov 8, 2019
1 parent 3861673 commit c65fa1f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/components/AccordionPanel/AccordionPanelContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ const AccordionPanelContentComponent: React.FC<Props & InjectedProps> = ({
[wrapperRef],
)

const handleExiting = useCallback(
(node: HTMLElement) => {
const wrapperHeight = wrapperRef.current ? wrapperRef.current.clientHeight : 0
node.style.height = `${wrapperHeight}px`
},
[wrapperRef],
)

const handleExited = (node: HTMLElement) => {
node.style.height = '0px'
}
Expand All @@ -50,6 +58,7 @@ const AccordionPanelContentComponent: React.FC<Props & InjectedProps> = ({
onEntering={handleEntering}
onEntered={handleEnterd}
onExit={handleExit}
onExiting={handleExiting}
onExited={handleExited}
timeout={{
enter: 300,
Expand Down

0 comments on commit c65fa1f

Please sign in to comment.