Commit Graph

9 Commits

Author SHA1 Message Date
Valentin Shergin 560652cfe8 Fabric: Proper implementation `-[RCTSurfaceTouchHandler reset]`
Summary:
Apparently, if a gesture recognizer got 'reset', OS does not call `touchesCancelled:` method, so we have to do it manually.
To implement this we have to split `_dispatchTouches:eventType:` into two methods: the first converts Objective-C touches to C++ touches, the second consumes that. We have to do this because during reset we don't have a collection of UIKit touches.

Reviewed By: mdvacca

Differential Revision: D13072807

fbshipit-source-id: 677e2febf9f96dcdfaadfadf5b9ab3893f93e796
2018-11-16 18:44:36 -08:00
Valentin Shergin 868406dbec Fabric: Using non-mutating `at` instead of `[]` for `-[RCTSurfaceTouchHandler _activeTouches]`
Summary: Every C++ engineer (except me several months ago) knows that `operator []` can mutate the collection (Yeah! Don't ask), so this is especially dangerous if your hash function is broken (see the previous diff).

Reviewed By: mdvacca

Differential Revision: D13072805

fbshipit-source-id: 4436a8ff12fb27a57bfb6ee0ff986d7a9a825549
2018-11-16 18:44:35 -08:00
Valentin Shergin 1de79e12e1 Fabric: Fixed bug in RCTSurfaceTouchHandler::PointerHasher
Summary:
Without this fix the PointerHasher hashed not a pointer, but an address where the pointer is stored, which is obviously incorrect.
The incorrect hash function compromised the whole `_activeTouches` caused many issues with logically invalid invariants (e.g. removing element from the collection silently didn't work).

Reviewed By: mdvacca

Differential Revision: D13072804

fbshipit-source-id: d68289e940fe21e2df08a31439619b7e2fe0fa13
2018-11-16 18:44:35 -08:00
Héctor Ramos 1151c096da Update copyright headers to yearless format
Summary: This change drops the year from the copyright headers and the LICENSE file.

Reviewed By: yungsters

Differential Revision: D9727774

fbshipit-source-id: df4fc1e4390733fe774b1a160dd41b4a3d83302a
2018-09-11 15:33:07 -07:00
Ramanpreet Nara 74c24147e2 Modify `RCTTouchableComponentViewProtocol` to get touch event emitter at point
Summary:
This diff includes two changes:
1. Even though `RCTViewComponentView` conforms to `RCTTouchableComponentViewProtocol`, it never implemented this protocol. This diff makes the correction.
2. Make the necessary changes to `RCTSurfaceTouchHandler` required by the changes in `RCTTouchableComponentViewProtocol`. This means modifying the `ActiveTouch` struct to hold `SharedTouchEventEmitter`s. It also means passing in the touch point to the `componentView`'s `touchEventEmitterAtPoint` method.

Reviewed By: shergin

Differential Revision: D9696909

fbshipit-source-id: 3d4a833f7dbae6d0238a0807eb2220250ccbae3d
2018-09-10 11:41:33 -07:00
Valentin Shergin 57b0e68a2c Fabric: `view` module was moved to `components` subdirectory
Summary:
@public
Trivial. We move all components into `/components/` subdirectory.

Reviewed By: mdvacca

Differential Revision: D8757011

fbshipit-source-id: 6a7da09e01184d41d37a1e1782c20d3c79371ae3
2018-07-15 16:52:26 -07:00
Valentin Shergin eabf29e320 Fabric: Getting rid of many `auto &&`
Summary:
@public
After reading about move-semantic and rvalue refs I realized that we (I) definitely overuse  `auto &&` (aka universal reference) construction. Even if this is harmless, does not look good and idiomatic.
Whenever I used that from a semantical point of view I always meant  "I need an alias for this" which is actually "read-only reference" which is `const auto &`.
This is also fit good to our policy where "everything is const (immutable) by default".
Hence I change that to how it should be.

Reviewed By: fkgozali

Differential Revision: D8475637

fbshipit-source-id: 0a691ededa0e798db8ffa053bff0f400913ab7b8
2018-06-22 07:32:49 -07:00
Valentin Shergin d49ebbcf62 Fabric: All *EventHandlers were renamed to *EventEmitter
Summary:
Using `EventHandlers` name was a bad idea, and I cannot tolerate it anymore.
The worst part of it is that when you have a collection of `EventHandlers` objects you cannot use plural word to describe it because `EventHandlers` is an already plural word.

And, this object is actually an event emitter, the thing on which we call events.

Reviewed By: fkgozali

Differential Revision: D8247723

fbshipit-source-id: b3303a4b9529bd6d32bb8ca0378287ebefaedda8
2018-06-09 13:16:45 -07:00
Valentin Shergin a32be38017 Fabric: Introducing RCTSurfaceTouchHandler
Summary:
RCTSurfaceTouchHandler is a complete rewrite of RCTTouchHandler which uses direct Fabric-specific event dispatching pipeline and several new approaches to managing active events (such as high-performant C++ collections, better management of identifier pool, and so on).
Besides that, the new implementation is much more W3C compliant that it used to be (see old TODOs near `receiveTouches()` implementation in Javascript).
So, touch events work now!

Reviewed By: fkgozali

Differential Revision: D8246713

fbshipit-source-id: 218dc15cd8f982237de7e2497ff36a7bfe6d37cc
2018-06-08 20:31:41 -07:00