Skip to content

Commit 38f8cd5

Browse files
committed
force rest even when animation appears to be done
1 parent 8b2403a commit 38f8cd5

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

src/Collapse.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -115,17 +115,12 @@ export class Collapse extends React.Component {
115115
return;
116116
}
117117

118-
const hasOpened = isOpened && this.container.style.height === `${contentHeight}px`;
119-
const hasClosed = !isOpened && this.container.style.height === '0px';
118+
this.container.style.overflow = isOpened ? 'initial' : 'hidden';
119+
this.container.style.height = isOpened ? 'auto' : '0px';
120120

121-
if (hasOpened || hasClosed) {
122-
this.container.style.overflow = isOpened ? 'initial' : 'hidden';
123-
this.container.style.height = isOpened ? 'auto' : '0px';
124-
125-
const {onRest} = this.props;
126-
if (onRest) {
127-
onRest({isFullyOpened, isFullyClosed, isOpened, containerHeight, contentHeight});
128-
}
121+
const {onRest} = this.props;
122+
if (onRest) {
123+
onRest({isFullyOpened, isFullyClosed, isOpened, containerHeight, contentHeight});
129124
}
130125
};
131126

0 commit comments

Comments
 (0)