Skip to content

Commit

Permalink
Prevent re-layout during animation (#400)
Browse files Browse the repository at this point in the history
  • Loading branch information
oblador authored Apr 29, 2021
1 parent 062de3a commit 1a7ae0c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Collapsible.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,13 @@ export default class Collapsible extends Component {

render() {
const { collapsed, enablePointerEvents } = this.props;
const { height, contentHeight, measuring, measured } = this.state;
const {
height,
contentHeight,
measuring,
measured,
animating,
} = this.state;
const hasKnownHeight = !measuring && (measured || collapsed);
const style = hasKnownHeight && {
overflow: 'hidden',
Expand Down Expand Up @@ -202,6 +208,9 @@ export default class Collapsible extends Component {
},
];
}
if (animating) {
contentStyle.height = contentHeight;
}
return (
<Animated.View
style={style}
Expand Down

0 comments on commit 1a7ae0c

Please sign in to comment.