Skip to content

Commit

Permalink
chore: 修改函数名及补充注释
Browse files Browse the repository at this point in the history
  • Loading branch information
iChengbo authored and zhiqingchen committed Apr 14, 2021
1 parent 64c9d95 commit 8eb6f68
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/taro-components-rn/src/components/Button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,16 @@ class _Button extends React.Component<ButtonProps, ButtonState> {
this.pressInTimer = setTimeout(() => {
this.setState({ isHover: true }, () => {
if (this.isTouchEnd) {
this.shortPress()
// short press
this.stopHover()
}
})
clearTimeout(this.pressInTimer)
}, hoverStartTime)
}
}

shortPress = (): void => {
stopHover = (): void => {
const { hoverStayTime } = this.props
this.pressOutTimer = setTimeout(() => {
this.setState({ isHover: false })
Expand All @@ -117,7 +118,8 @@ class _Button extends React.Component<ButtonProps, ButtonState> {
const { isHover } = this.state
this.isTouchEnd = true
if (hoverStyle && isHover) {
this.shortPress()
// long press or error boundary
this.stopHover()
}
}

Expand Down

0 comments on commit 8eb6f68

Please sign in to comment.