Skip to content

Commit

Permalink
fix(components): ScrollView event #fix 3484
Browse files Browse the repository at this point in the history
  • Loading branch information
ZakaryCode committed Jan 27, 2020
1 parent 97aaaa5 commit ff710a6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/taro-components/src/components/scroll-view/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ function easeOutScroll (from, to, callback) {
}
function throttle (fn, delay) {
let timer = null
return function () {
return function (...arrs) {
clearTimeout(timer)
timer = setTimeout(function () {
fn()
fn(...arrs)
}, delay)
}
}
Expand Down Expand Up @@ -140,7 +140,7 @@ class ScrollView extends Nerv.Component {
)
upperThreshold = parseInt(upperThreshold)
lowerThreshold = parseInt(lowerThreshold)
const uperAndLower = () => {
const uperAndLower = (e) => {
const {
offsetWidth,
offsetHeight,
Expand All @@ -156,14 +156,14 @@ class ScrollView extends Nerv.Component {
(this.props.scrollX &&
offsetWidth + scrollLeft + lowerThreshold >= scrollWidth))
) {
onScrollToLower()
onScrollToLower(e)
}
if (
onScrollToUpper &&
((this.props.scrollY && scrollTop <= upperThreshold) ||
(this.props.scrollX && scrollLeft <= upperThreshold))
) {
onScrollToUpper()
onScrollToUpper(e)
}
}
const uperAndLowerThrottle = throttle(uperAndLower, 200)
Expand All @@ -186,7 +186,7 @@ class ScrollView extends Nerv.Component {
scrollWidth
}
})
uperAndLowerThrottle()
uperAndLowerThrottle(e)
onScroll && onScroll(e)
}
const _onTouchMove = e => {
Expand Down

0 comments on commit ff710a6

Please sign in to comment.