minwork / use-long-press

React hook for detecting click (or tap) and hold event
MIT License
120 stars 12 forks source link

Provide migration guide from v1 to v2 / v3 #44

Closed minwork closed 1 year ago

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Nantris commented 1 year ago

Anybody know how to upgrade to 2.x?

Nantris commented 1 year ago

I studied the docs, examples, code, but upgrading from 1.x to 2.x doesn't work. No amount of holding down the button affects anything.

1.x works great so we'll move back to that - but I'd love to upgrade just to remove it from the list of upgradable packages in npm-check-updates.

Thanks for the great project @minwork.

minwork commented 1 year ago

Hey @Slapbox what've changed between v1 and v2 is the result of const bind = useLongPress(...). In v1 you received object that you could spread to component like {...bind} and in v2 you have function {...bind()} where you can pass context as argument in order to be able to access it on callbacks

Nantris commented 1 year ago

It works like a charm! Thanks so much @minwork!

minwork commented 1 year ago

Migration guide will be released along with v3 but you can already access it here

Nantris commented 1 year ago

@minwork thanks for the update! What was the default value for detect prior to v3?

minwork commented 1 year ago

'both', but it will be replaced with 'pointer' when I finish implementing PointerEvents.