Demonstration of mouse and touch events in React using RxJS Observables. Also shows handling edit mode outside of the observables (within the double-click or double-tap event handler) in order to ensure an iOS/tablet keyboard displays and hides correctly.
https://dfbaskin.github.io/react-mouse-touch-events
The version-one
branch uses touch
and mouse events.
The version-two
branch uses pointer events.
React does not support pointer events
directly, so the react-pointable
component is used.
The version-three
branch uses an updated version of React that now has support for
pointer events.
The master
branch was updated to use
hooks and creates
a usePointerEvents
hook along with a callback API.
Update May 7, 2019
Added an additional example with the useMethods
hook (which also uses Immer) that I
think cleans things up a bit.
This project was bootstrapped with Create React App.