From cfb69719c1c68d004668472eea71150c647e6f9e Mon Sep 17 00:00:00 2001 From: "Son, Joon" Date: Tue, 29 Oct 2019 11:42:00 -0700 Subject: [PATCH 1/2] Add onLayout prop --- src/SortableList.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/SortableList.js b/src/SortableList.js index 3d3ff9f..fcf01e7 100644 --- a/src/SortableList.js +++ b/src/SortableList.js @@ -36,6 +36,7 @@ export default class SortableList extends Component { onChangeOrder: PropTypes.func, onActivateRow: PropTypes.func, + onLayout: PropTypes.func, onReleaseRow: PropTypes.func, }; @@ -338,7 +339,9 @@ export default class SortableList extends Component { contentHeight, contentWidth, }, () => { - this.setState({animated: true}); + this.setState({animated: true}, () => { + this.props.onLayout(); + }); }); }); }); From 2f7faee04ae16fded718cc10743e2bb4d386d760 Mon Sep 17 00:00:00 2001 From: "Son, Joon" Date: Tue, 29 Oct 2019 14:31:52 -0700 Subject: [PATCH 2/2] check for prop existance --- src/SortableList.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/SortableList.js b/src/SortableList.js index fcf01e7..4dd876b 100644 --- a/src/SortableList.js +++ b/src/SortableList.js @@ -340,7 +340,9 @@ export default class SortableList extends Component { contentWidth, }, () => { this.setState({animated: true}, () => { - this.props.onLayout(); + if (this.props.onLayout) { + this.props.onLayout(); + } }); }); });