Skip to content

Commit

Permalink
fix: measure content height on layout change (#147)
Browse files Browse the repository at this point in the history
* fix: measure content height on layout change

When you were with collapsible opened (`state.collapsed = false`) and children changes it's height, Collapsible component was breaking the layout.

* style: prettify Collapsible.js
  • Loading branch information
eduardomoroni authored and iRoachie committed Apr 15, 2018
1 parent 85bade3 commit 117f7a1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Collapsible.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,13 @@ export default class Collapsible extends Component {
) {
return;
}
this.state.height.setValue(contentHeight);
this.setState({ contentHeight });

this._measureContent(contentHeight => {
this.setState({
contentHeight,
height: new Animated.Value(contentHeight),
});
});
};

render() {
Expand Down

0 comments on commit 117f7a1

Please sign in to comment.