Closed JakeSidSmith closed 8 years ago
Hi @JakeSidSmith,
I stumbled upon your repo as I was looking for an alternative to fastclick
. Fastclick doesn't work properly natively with react-select
on mobile.
Your PR makes it work correctly, so yay ! :)
However there seem to be a conflict with the Link
component of react-router
: when I navigate to the app and click on Link
components, the app performs a full refresh of the page.
If I remove react-fastclick
Links work properly again (but indeed, the whole app feels sluggish on mobile).
Some info:
react v0.14.6
react-router: 2.0.0-rc4
using browserHistory
Thanks for testing this out @slybridges. I thought I had fixed the issues with react-router, but I guess not. Will take a look later today. :)
@slybridges Have just tried this branch out with 2 different projects that use react-router
, and I don't have this problem. Though they are running react-router
versions 0.13
and 1.0.0
. Could you try clearing react-fastclick
from your node_modules
and rebuild. If you still experience that issue, I'll create a new project with react-router
2.0.0
and try to debug. :)
Hi @JakeSidSmith unfortunately clearing the module from node-modules didn't help.
I was able to reproduce the issue using theredux-easy-boilerplate
repo https://github.com/anorudes/redux-easy-boilerplate).
You'll find a version ready to be tested along with my observations there: https://github.com/slybridges/redux-easy-boilerplate/tree/master
As you'll notice, problem seems to be with using react-fastclick
along with createHistory
(the one using HTML5 API). Using createHashHistory
(the one using legacy '#' keyed URLs), no problem arises. And using createHistory
without react-fastclick
works too.
Hope this can be of some help for you!
Hey, @slybridges think it's fixed now.
The link component was checking for the button that was clicked (to make sure it wasn't a right click), so I'm just adding this to the event - event.button = 0;
.
I've also modified the event.type
to be click
to avoid other libraries that may check for this, and added a fastclick
key so users scan still tell the difference as mentioned in #4.
Will do some additional work to push in clientX, pageX, etc so that people that are expecting an actual click event can still access all the usual values, and then this branch should be good to go. :)
Hi @JakeSidSmith, it seems to be working alright for me now thanks ! Although I'm yet to deploy to production environnement with it and asses the benefits :)
@JakeSidSmith Looks awesome :sparkles:
Awesome 🤑
onClick
props with additional event propsReact.DOM.x
element creationNew features (mentioned in / fixes #4)
event.button = 0
event.type
toclick
event.fastclick = true
Need testers! Update your package.json
Include react-fastclick
Please post what version of react you've tested with, what devices / browsers you've tested on, which elements / components (if any) you have had problems with, and what libraries may be affecting this.