Skip to content

Commit

Permalink
fix: last category not activating when scrolled to bottom
Browse files Browse the repository at this point in the history
  • Loading branch information
scttcper committed Apr 13, 2018
1 parent 5540705 commit 7e6cdd8
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/lib/picker/picker.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,17 +275,18 @@ export class PickerComponent implements OnInit, AfterViewInit {
activeCategory = this.SEARCH_CATEGORY;
} else {
const target = this.scrollRef.nativeElement;

for (const category of this.categories) {
const component = this.categoryRefs!.find(n => n.id === category.id);

if (component) {
const active = component.handleScroll(target.scrollTop);

// check scroll is not at bottom
if (target.scrollHeight - target.scrollTop !== this.clientHeight) {
for (const category of this.categories) {
const component = this.categoryRefs!.find(n => n.id === category.id);
const active = component!.handleScroll(target.scrollTop);
if (active) {
activeCategory = category;
}
}
} else {
// scrolled to bottom activate last category
activeCategory = this.categories[this.categories.length - 1];
}

this.scrollTop = target.scrollTop;
Expand Down

0 comments on commit 7e6cdd8

Please sign in to comment.