Skip to content

Conversation

@zhuangtianyu
Copy link

I added the following code:

window.addEventListener('resize', this.resetIsTouch, true)

window.removeEventListener('resize', this.resetIsTouch, true)

resetIsTouch = () => this.isTouch = false

to ensure the code below can be executed normally:

handle = e => {
  if (e.type === 'touchend') this.isTouch = true
  if (e.type === 'click' && this.isTouch) return
  const { onClickOutside } = this.props
  const el = this.container
  if (el && !el.contains(e.target)) onClickOutside(e)
}

while the browser switches from mobile mode to PC mode.

@zhuangtianyu zhuangtianyu changed the title fix: unable to trigger onClickOutside once mobile mode switches to PC mode. fix: unable to trigger onClickOutside once mobile client resize to PC client. Dec 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant