From e28dc4da55481c675cddd08dd179329ad7d733ff Mon Sep 17 00:00:00 2001 From: Etienne Lemay Date: Sat, 27 May 2017 12:58:46 -0400 Subject: [PATCH] Make sure last category is selected when scrolled to bottom --- src/components/picker.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/components/picker.js b/src/components/picker.js index 2ff0a4b..dd12eed 100644 --- a/src/components/picker.js +++ b/src/components/picker.js @@ -233,6 +233,8 @@ export default class Picker extends React.Component { activeCategory = category break } + } else if (scrollTop + this.clientHeight >= this.scrollHeight) { + activeCategory = this.categories[this.categories.length - 1] } if (activeCategory) { @@ -305,6 +307,12 @@ export default class Picker extends React.Component { let component = this.refs[`category-${i}`] if (component) component.memoizeSize() } + + if (this.refs.scroll) { + let target = this.refs.scroll + this.scrollHeight = target.scrollHeight + this.clientHeight = target.clientHeight + } } getCategories() {