mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
72d0ddc16f
Summary: The `Event` interface has been improved such that: 1. `getEventData` is now a default method on Event that returns null 2. `dispatch` has a default implementation that relies on getEventName() and getEventData() 3. `dispatchModern` can detect if surfaceId and event data are present; if not, it falls back to dispatch This will dramatically ease future migrations: at some point in the (distant) future, we can simply delete RCTEventEmitter and all use-cases will be supported by the current `Event` class without needing to introduce a 3rd transitional interface; and 99% of all Event classes can be simplified, delet their `dispatch` implementation and need no further work. At their core, all Events are simply: (1) a name, (2) data, (3) a target (surfaceId and tag). The interface now reflects that but still allows for flexibility of the data and names being generated on-demand if necessary; but for the vast majority of Event classes, code will be dramatically simplified. I also migrate a single Event class, ContentSizeChangeEvent, to use this new method of dispatch. Changelog: [Android][Changed] Added convenience methods to simplify native Event classes and ease migrations Reviewed By: mdvacca Differential Revision: D26043325 fbshipit-source-id: bc308105f7f6e654d45fd156dbf4a2bcbc45819c