mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Refactor event dispatching logic to improve readability and performance slightly (#50991)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/50991 Changelog: [internal] TSIA. Reviewed By: javache Differential Revision: D73853068 fbshipit-source-id: 93e33072e4ce14225cc76ca8daf5d8816489ac7b
This commit is contained in:
committed by
Facebook GitHub Bot
parent
030ca3c543
commit
6dc4da466a
@@ -34,15 +34,15 @@ void EventQueue::enqueueEvent(RawEvent&& rawEvent) const {
|
||||
auto repeatedEvent = eventQueue_.rend();
|
||||
|
||||
for (auto it = eventQueue_.rbegin(); it != eventQueue_.rend(); ++it) {
|
||||
if (it->type == rawEvent.type &&
|
||||
it->eventTarget == rawEvent.eventTarget && it->isUnique) {
|
||||
repeatedEvent = it;
|
||||
break;
|
||||
} else if (it->eventTarget == rawEvent.eventTarget) {
|
||||
if (it->eventTarget == rawEvent.eventTarget) {
|
||||
// It is necessary to maintain order of different event types
|
||||
// for the same target. If the same target has event types A1, B1
|
||||
// in the event queue and event A2 occurs. A1 has to stay in the
|
||||
// queue.
|
||||
if (it->isUnique && it->type == rawEvent.type) {
|
||||
repeatedEvent = it;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user