unclecheese / react-selectable

A component for react that allows mouse selection of child items
MIT License
142 stars 72 forks source link

Added support for touch-based (mobile) events. #12

Open leopoldjoy opened 8 years ago

leopoldjoy commented 8 years ago

@unclecheese Note, I added a note at the bottom of README.md linking to my extended-features fork. Please let me know if you would prefer for me to remove this.

leopoldjoy commented 8 years ago

@unclecheese Please let me know if you would like any additional changes made to the touch-device functionality.

leopoldjoy commented 8 years ago

@unclecheese Thanks for the feedback! I made the syntactic changes and moved the mouse event tracking booleans out of the state.

In regards to your question of why we need to track the events: some devices are both click and touch enabled. On such devices the event handlers could fire twice. For example:

ReactDOM.findDOMNode(this).addEventListener('mousedown', this._mouseDown);
ReactDOM.findDOMNode(this).addEventListener('touchstart', this._mouseDown);

Additionally, for the mousemove/touchmove handlers, they could be doubly firing. Due to these inconsistencies of which events fire or are supported across platforms, I thought it best to guarantee that the functions are always fired in the correct order and not duplicated. What are your thoughts on this? I am open to altering this if you feel differently about it.

leopoldjoy commented 8 years ago

Sorry, I had forgot to rebuild the bundle. Committed that now. I'm now working on updating the gh-pages branch so that the example has the new touch functionality. I will push shortly.

leopoldjoy commented 8 years ago

Ok, everything is cleaned up and the gh-pages branch is rebundled. Please let me know if you feel that any other changes should be made.

leopoldjoy commented 8 years ago

@unclecheese Please let me know if there are any additional changes you feel should be made.

unclecheese commented 8 years ago

Thanks! I'll have a look at it in the next few days.

leopoldjoy commented 8 years ago

@unclecheese Did you get a chance to look through the changes? Let me know if you feel any changes should be made.

aldahick commented 6 years ago

@unclecheese Any update on this? Love the library, but mobile users are out of luck without this.

shubham-2710 commented 5 years ago

Any Update on this for mobile touch ?

danielmockaitis commented 5 years ago

Can we please mobile support with this?