JedWatson / react-tappable

Tappable component for React
http://jedwatson.github.io/react-tappable/
MIT License
862 stars 90 forks source link

Does is make sense to add pinch controls to the same component? #10

Closed nmn closed 9 years ago

nmn commented 9 years ago

I'm glad I found react-tappable, as I was gonna write the same thing for use in my project. The common touch controls are handled here.

I have one issue, and one question

The callback can receive an object with

{
    originalEvent: originalTouchEvent
    zoomRatio: Number as ratio of original size (for example 2 or 0.5)
    displacement: Movement in pixels of the center of the pinch
    rotation: Degrees
}

The rest of the smarts can be handled outside the element, so this should be enough.

JedWatson commented 9 years ago

I think it would be a good idea to prototype handling multi touch events in this component, it makes sense to reduce the complexity for integration by only having one component / mixin that handles touch interactions.

The other interaction that I've been thinking about are swipe interactions, especially controlled-swipes (like in the Mail app in iOS where you can swipe left or right to expose actions, or all the way to toggle read / delete the message).

Would you be interested in making a PR to fix the e.touches.length issue, and / or one that adds pinch support?

nmn commented 9 years ago

I've already started the work. Maybe another two days to finish and test pinch support.

I don't have anything to support swipes but that could be added.