Unselect categories when searching
parent
1e87212374
commit
7d014966e6
|
@ -198,43 +198,48 @@ export default class Picker extends React.Component {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var target = this.refs.scroll,
|
let activeCategory = null
|
||||||
scrollTop = target.scrollTop,
|
|
||||||
scrollingDown = scrollTop > (this.scrollTop || 0),
|
|
||||||
activeCategory = null,
|
|
||||||
minTop = 0
|
|
||||||
|
|
||||||
for (let i = 0, l = this.categories.length; i < l; i++) {
|
if (SEARCH_CATEGORY.emojis) {
|
||||||
let ii = scrollingDown ? (this.categories.length - 1 - i) : i,
|
activeCategory = SEARCH_CATEGORY
|
||||||
category = this.categories[ii],
|
} else {
|
||||||
component = this.refs[`category-${ii}`]
|
var target = this.refs.scroll,
|
||||||
|
scrollTop = target.scrollTop,
|
||||||
|
scrollingDown = scrollTop > (this.scrollTop || 0),
|
||||||
|
minTop = 0
|
||||||
|
|
||||||
if (component) {
|
for (let i = 0, l = this.categories.length; i < l; i++) {
|
||||||
let active = component.handleScroll(scrollTop)
|
let ii = scrollingDown ? (this.categories.length - 1 - i) : i,
|
||||||
|
category = this.categories[ii],
|
||||||
|
component = this.refs[`category-${ii}`]
|
||||||
|
|
||||||
if (!minTop || component.top < minTop) {
|
if (component) {
|
||||||
if (component.top > 0) {
|
let active = component.handleScroll(scrollTop)
|
||||||
minTop = component.top
|
|
||||||
|
if (!minTop || component.top < minTop) {
|
||||||
|
if (component.top > 0) {
|
||||||
|
minTop = component.top
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (active && !activeCategory) {
|
||||||
|
activeCategory = category
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scrollTop < minTop) {
|
||||||
|
for (let category of this.categories) {
|
||||||
|
if (category.anchor === false) { continue }
|
||||||
|
|
||||||
if (active && !activeCategory) {
|
|
||||||
activeCategory = category
|
activeCategory = category
|
||||||
|
break
|
||||||
}
|
}
|
||||||
|
} else if (scrollTop + this.clientHeight >= this.scrollHeight) {
|
||||||
|
activeCategory = this.categories[this.categories.length - 1]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scrollTop < minTop) {
|
|
||||||
for (let category of this.categories) {
|
|
||||||
if (category.anchor === false) { continue }
|
|
||||||
|
|
||||||
activeCategory = category
|
|
||||||
break
|
|
||||||
}
|
|
||||||
} else if (scrollTop + this.clientHeight >= this.scrollHeight) {
|
|
||||||
activeCategory = this.categories[this.categories.length - 1]
|
|
||||||
}
|
|
||||||
|
|
||||||
if (activeCategory) {
|
if (activeCategory) {
|
||||||
let { anchors } = this.refs,
|
let { anchors } = this.refs,
|
||||||
{ name: categoryName } = activeCategory
|
{ name: categoryName } = activeCategory
|
||||||
|
|
Loading…
Reference in New Issue