-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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
onTouchStart, onTouchMove and onTouchEnd aren't true multi-touch #10068
Comments
They certainly are multi touch, they give you entire touch history on the screen. See https://facebook.github.io/react-native/docs/gesture-responder-system.html for more detailed information on touches including
Now creating two touchable sliders might a bit more difficult since if they are separate views, they would likely cancel each other. That's why React gives you ability to create your own native view subclasses and add your gesture events. The MapView example at https://facebook.github.io/react-native/docs/native-components-ios.html can certainly accept multi touch gestures. |
This is what I'm talking about sorry, multi-touch over separate views. The fact that you have to create a native view to be able to press two buttons at the same time seems like a fundamental limitation, and unnecessarily restricts the utility. So you're saying there's no pure RN way of reacting simultaneously to gestures on different view simultaneously? |
Sorry @hey99xx could you just confirm that there's no way to control two views at the same time with pure RN? It's not possible to bypass all the responder stuff and hook straight into touch events coming from the native views? |
Hey Rob. I'm not a FB employee or a contributor, so don't take my word :) you might prefer to choose from from a more authoritative person. With Hooking straight into touch events might work. I've investigated a little into it earlier, but my problem was different (I was trying to find how to terminate responders from native side similar to how scroll view drag gesture works). If there is a way, you will likely need an extensive look at https://github.com/facebook/react/tree/15-dev/src/renderers/shared/stack/event and especially https://github.com/facebook/react/blob/15-dev/src/renderers/shared/stack/event/eventPlugins/ResponderEventPlugin.js where all responder rejections / grants etc happen. Edit |
Yeah I know it's impossible with Touchables, but I've had some success with hooking into the onTouchX methods directly on Views. But this doesn't work on android. |
@robclouth Did you ever resolve your issue? Or could you confirm that multi-gesture support is not currently implemented? Once @kmagiera finishes his work on react-native-gesture-handler, that might be the solution (which is to not use React's JS responder system at all). It would be nice if a FB employee could chime in here. 😄 |
Hey. Basically multiple touches on separate views works on iOS, using the |
That's not ideal, considering you don't get separate I whipped up some commits to support multiple views handling gestures simultaneously: 72242ff - BUGFIX: Ensures 113f2c6 - Implements multi-gesture support for facebook/react 0116996 - Allows multiple JS responders in RCTUIManager
|
Alright, I finished all the necessary work (no test suite yet) and updated the commit SHAs in the above comment. If you get the chance, let me know if Cheers 🍻 |
I'm using RN 0.33.
The onTouchStart, onTouchMove and onTouchEnd props of View aren't multi-touch. You can't control two at the same time which heavily restricts their usefulness!
For example, it's impossible to create two sliders that can be controlled independently.
The text was updated successfully, but these errors were encountered: