diff --git a/src/SortableList.js b/src/SortableList.js index 662a8ba..c3e416c 100644 --- a/src/SortableList.js +++ b/src/SortableList.js @@ -215,7 +215,6 @@ export default class SortableList extends Component { enabled: scrollEnabled, // fix for Android }); } - return ( { // Can get correct container’s layout only after rows’s layouts. this._container.measure((x, y, width, height, pageX, pageY) => { @@ -339,15 +339,22 @@ export default class SortableList extends Component { contentWidth += layout.width; }); - this.setState({ + const newState = { containerLayout: {x, y, width, height, pageX, pageY}, rowsLayouts: rowsLayoutsByKey, headerLayout, footerLayout, contentHeight, contentWidth, - }, () => { - this.setState({animated: true}); + }; + + + this.setState(newState, () => { + this.setState({animated: true}, () => { + if (this.props.onLayout) { + this.props.onLayout(); + } + }); }); }); });