rooks
rooks copied to clipboard
feat: useClickAndHold hook
I created a simple new hook that give the ability of click and hold.
Codecov Report
Merging #602 (13dcf7d) into main (260e606) will increase coverage by
4.25%
. The diff coverage is87.50%
.
@@ Coverage Diff @@
## main #602 +/- ##
==========================================
+ Coverage 72.94% 77.20% +4.25%
==========================================
Files 66 68 +2
Lines 1327 1408 +81
Branches 268 282 +14
==========================================
+ Hits 968 1087 +119
+ Misses 358 320 -38
Partials 1 1
Impacted Files | Coverage Δ | |
---|---|---|
src/hooks/useClickAndHold.ts | 87.50% <87.50%> (ø) |
|
src/hooks/useTimeout.ts | 100.00% <0.00%> (ø) |
|
src/hooks/usePrevious.ts | 100.00% <0.00%> (ø) |
|
src/hooks/useWarningOnMountInDevelopment.ts | 100.00% <0.00%> (ø) |
|
src/hooks/useInterval.ts | 90.00% <0.00%> (+0.71%) |
:arrow_up: |
src/hooks/useSessionstorage.ts | 81.63% <0.00%> (+0.78%) |
:arrow_up: |
src/hooks/useVisibilitySensor.ts | 5.88% <0.00%> (+0.88%) |
:arrow_up: |
src/hooks/useUpdateEffect.ts | 92.85% <0.00%> (+1.19%) |
:arrow_up: |
src/hooks/useDebounce.ts | 100.00% <0.00%> (+6.66%) |
:arrow_up: |
src/hooks/warning.ts | 100.00% <0.00%> (+53.84%) |
:arrow_up: |
... and 4 more |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 260e606...13dcf7d. Read the comment docs.
@jefersonvinicius Awesome hook! Could you explain more about what this hook can do here for context as I review it?
Hey @imbhargav5. The hook returns handlers (e.g onClick, onMouseDown, etc...) that you can attach to some HTML element, so, when element is clicked the action is triggered or if the user hold the element, the action is triggered with a interval until user release the element.
I would like add some codesandbox, but I haven't sure if the pull request should be merged first to be able install rooks lib in codesandbox with this hook available.
I would like add some codesandbox, but I haven't sure if the pull request should be merged first to be able install rooks lib in codesandbox with this hook available.
Hi @jefersonvinicius, I guess you could copy this hook's source code to codesandbox and create an example first. Later after this hook is published we will help update the codesandbox!
Hi @jefersonvinicius, I guess you could copy this hook's source code to codesandbox and create an example first. Later after this hook is published we will help update the codesandbox!
I'll do it. Thanks for the suggestion. I'm making some improvements as well!
Hey @imbhargav5 and @qiweiii. I added a codesandbox example in useClickAndHold.md
file! Let me know if now is right for the review! :D
Hi @jefersonvinicius . Very sorry for being slow to respond. Totally my fault. Will get to this in the weekend!
Hey, it's everything alright :D
It's cool! and how about using the pointer events instead of mouse or touch events? Most browsers support it.
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.