Skip to content
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

Allow user-specified click rejection #25

Merged
merged 2 commits into from
Jan 29, 2016
Merged

Conversation

tomhicks-bsf
Copy link

There are occasions where you might want to reject clicks using a
different strategy than just based on time-between-events. This
allows the consumer to supply their own way of deciding whether or
not to trigger the click event.

@ThomWright
Copy link

@s0meone Any chance of merging this soon?

@madjam002
Copy link

What's the status on this? This is really helpful.

@tomhicks-bsf
Copy link
Author

For cross-reference, this fixes #15 (which was closed but never fixed)

@ThomWright
Copy link

@s0meone Don't mean to be a pain, but we'd really like this merged. It's a non-breaking change.

@s0meone
Copy link

s0meone commented Jan 29, 2016

Sorry for the delay, I'm currently not working on any React related projects, but I've made some time today, so I can look into this.

@@ -0,0 +1,5 @@
module.exports = function(lastTouchEvent, clickTimestamp) {
if (lastTouchEvent && (clickTimestamp - lastTouchEvent) < 750) {
return null;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to change this to true to actually ignore the click event.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah I recently changed this to work on React 14 and messed up. Should return true so caller can return null.

@s0meone
Copy link

s0meone commented Jan 29, 2016

Looks good, but the default strategy does not work like the current strategy. If you could change that I can merge it. Again, sorry for the delay.

It needs to return true so the calling function can return null.
s0meone added a commit that referenced this pull request Jan 29, 2016
Allow user-specified click rejection
@s0meone s0meone merged commit 7f46092 into zilverline:master Jan 29, 2016
s0meone added a commit that referenced this pull request Jan 29, 2016
@ThomWright
Copy link

Thanks! :)

@madjam002
Copy link

@s0meone Thanks for merging 👍 If you're not working on React related projects anymore, are you looking for new maintainers?

We use this library at our organisation (@momentumft), and would be prepared to keep it up to date.

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.

None yet

4 participants