-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: useLongPress add onEnd callback #1478
Conversation
|
Related: #1477 |
@@ -45,6 +47,9 @@ function useLongPress( | |||
if (timerRef.current) { | |||
clearTimeout(timerRef.current); | |||
} | |||
if (shouldTriggerClick && isTriggeredRef.current) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是不是只用暴露一个 onEnd
,然后不管是 longPress 还是 click 结束,都调用 onEnd 就可以了?
不用区分是长按结束还是点击结束。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是不是只用暴露一个
onEnd
,然后不管是 longPress 还是 click 结束,都调用 onEnd 就可以了?不用区分是长按结束还是点击结束。
是这样~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
那就是第一个 commit 那样了~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我想想,这里比较纠结的。
两个各有优劣的。我来优化下代码。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
[中文版模板 / Chinese template]
🤔 This is a ...
🔗 Related issue link
💡 Background and solution
📝 Changelog
☑️ Self Check before Merge