From 2cf75cff700abd2d477d268468d40e2a3ca4804a Mon Sep 17 00:00:00 2001 From: Paul Antropius Date: Sat, 18 Aug 2018 08:56:51 +0200 Subject: [PATCH 1/2] add the current order to _onReleaseRow callback --- src/SortableList.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SortableList.js b/src/SortableList.js index be7d2d0..1d1db50 100644 --- a/src/SortableList.js +++ b/src/SortableList.js @@ -591,7 +591,7 @@ export default class SortableList extends Component { })); if (this.props.onReleaseRow) { - this.props.onReleaseRow(rowKey); + this.props.onReleaseRow(rowKey, this.state.order); } }; From 77b11a686ffeae67a8095cf55fe53a92ba4dabe9 Mon Sep 17 00:00:00 2001 From: Paul Antropius Date: Sat, 18 Aug 2018 08:56:51 +0200 Subject: [PATCH 2/2] add the current order to _onReleaseRow callback --- README.md | 4 ++-- src/SortableList.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7672876..19d3859 100644 --- a/README.md +++ b/README.md @@ -56,8 +56,8 @@ Called when rows were reordered, takes an array of rows keys of the next rows or `(key) => void`
Called when a row was activated (user long tapped). - **onReleaseRow?** (function)
-`(key) => void`
-Called when the active row was released. +`(key, currentOrder) => void`
+Called when the active row was released. Returns the key and the new list order. - **onPressRow?** (function)
`(key) => void`
Called when a row was pressed. diff --git a/src/SortableList.js b/src/SortableList.js index be7d2d0..1d1db50 100644 --- a/src/SortableList.js +++ b/src/SortableList.js @@ -591,7 +591,7 @@ export default class SortableList extends Component { })); if (this.props.onReleaseRow) { - this.props.onReleaseRow(rowKey); + this.props.onReleaseRow(rowKey, this.state.order); } };