TouchEvent.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7. #pragma once
  8. #include <react/debug/DebugStringConvertible.h>
  9. #include <unordered_set>
  10. #include <react/components/view/Touch.h>
  11. namespace facebook {
  12. namespace react {
  13. using Touches = std::unordered_set<Touch, Touch::Hasher, Touch::Comparator>;
  14. /*
  15. * Defines the `touchstart`, `touchend`, `touchmove`, and `touchcancel` event
  16. * types.
  17. */
  18. struct TouchEvent {
  19. /*
  20. * A list of Touches for every point of contact currently touching the
  21. * surface.
  22. */
  23. Touches touches;
  24. /*
  25. * A list of Touches for every point of contact which contributed to the
  26. * event.
  27. */
  28. Touches changedTouches;
  29. /*
  30. * A list of Touches for every point of contact that is touching the surface
  31. * and started on the element that is the target of the current event.
  32. */
  33. Touches targetTouches;
  34. };
  35. #if RN_DEBUG_STRING_CONVERTIBLE
  36. std::string getDebugName(TouchEvent const &touchEvent);
  37. std::vector<DebugStringConvertibleObject> getDebugProps(
  38. TouchEvent const &touchEvent,
  39. DebugStringConvertibleOptions options);
  40. #endif
  41. } // namespace react
  42. } // namespace facebook