From 1ddffe39e64978ce96e8b7a228094aa7228a7ad8 Mon Sep 17 00:00:00 2001 From: jeet-dhandha Date: Thu, 28 Jul 2022 10:12:58 +0530 Subject: [PATCH 1/3] Scroll to top on select or deselect of the user --- src/components/OptionsSelector.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/OptionsSelector.js b/src/components/OptionsSelector.js index 2f113f58dd03..294c8fd4e241 100755 --- a/src/components/OptionsSelector.js +++ b/src/components/OptionsSelector.js @@ -221,7 +221,7 @@ class OptionsSelector extends Component { focusedIndex: newFocusedIndex, }, () => { // If we just selected a new option on a multiple-selection page, scroll to the top - if (this.props.selectedOptions.length > prevProps.selectedOptions.length) { + if (this.props.selectedOptions.length > 0) { this.scrollToIndex(0); return; } From 6e89f8d5b6952aacdcbfe9238bd60f6a3e3dd5b6 Mon Sep 17 00:00:00 2001 From: jeet-dhandha Date: Thu, 28 Jul 2022 10:22:52 +0530 Subject: [PATCH 2/3] Change implementation --- src/components/OptionsSelector.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/OptionsSelector.js b/src/components/OptionsSelector.js index 294c8fd4e241..ebb9c64378db 100755 --- a/src/components/OptionsSelector.js +++ b/src/components/OptionsSelector.js @@ -220,8 +220,8 @@ class OptionsSelector extends Component { allOptions: newOptions, focusedIndex: newFocusedIndex, }, () => { - // If we just selected a new option on a multiple-selection page, scroll to the top - if (this.props.selectedOptions.length > 0) { + // If we just selected or deselected an option on a multiple-selection page, scroll to the top + if (this.props.selectedOptions.length !== prevProps.selectedOptions.length) { this.scrollToIndex(0); return; } From 35dc6a2729612dc70bc3ac2bcc2bf088794be7dd Mon Sep 17 00:00:00 2001 From: jeet-dhandha Date: Thu, 28 Jul 2022 10:33:47 +0530 Subject: [PATCH 3/3] Changed comment --- src/components/OptionsSelector.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/OptionsSelector.js b/src/components/OptionsSelector.js index ebb9c64378db..c41677a0d775 100755 --- a/src/components/OptionsSelector.js +++ b/src/components/OptionsSelector.js @@ -220,7 +220,7 @@ class OptionsSelector extends Component { allOptions: newOptions, focusedIndex: newFocusedIndex, }, () => { - // If we just selected or deselected an option on a multiple-selection page, scroll to the top + // If we just toggled an option on a multi-selection page, scroll to top if (this.props.selectedOptions.length !== prevProps.selectedOptions.length) { this.scrollToIndex(0); return;