mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
2016460528
Summary: Changelog: [internal] This is a mechanism that will guess event's React priority based on other events ongoing on the platform. If an event happens within span of ContinuousStart -> ContinuousEnd and its category is unspecified, we deduce it's React priority to be default. All other events are discrete. Special case: `onScroll`, which is always treated as "Default". Reviewed By: JoshuaGross Differential Revision: D28485060 fbshipit-source-id: d2eae63dbcf03271dfed97128a1590dd165a3ce2
73 lines
1.6 KiB
C++
73 lines
1.6 KiB
C++
/*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
|
|
#include <react/renderer/core/EventTarget.h>
|
|
#include <react/renderer/core/ValueFactory.h>
|
|
|
|
namespace facebook {
|
|
namespace react {
|
|
|
|
/*
|
|
* Represents ready-to-dispatch event object.
|
|
*/
|
|
struct RawEvent {
|
|
/*
|
|
* Defines category of a native platform event. This is used to deduce types
|
|
* of events for Concurrent Mode.
|
|
*/
|
|
enum class Category {
|
|
/*
|
|
* Start of a continuous event. To be used with touchStart.
|
|
*/
|
|
ContinuousStart,
|
|
|
|
/*
|
|
* End of a continuous event. To be used with touchEnd.
|
|
*/
|
|
ContinuousEnd,
|
|
|
|
/*
|
|
* Priority for this event will be determined from other events in the
|
|
* queue. If it is triggered by continuous event, its priority will be
|
|
* default. If it is not triggered by continuous event, its priority will be
|
|
* discrete.
|
|
*/
|
|
Unspecified,
|
|
|
|
/*
|
|
* Forces discrete type for the event. Regardless if continuous event is
|
|
* ongoing.
|
|
*/
|
|
Discrete,
|
|
|
|
/*
|
|
* Forces continuous type for the event. Regardless if continuous event
|
|
* isn't ongoing.
|
|
*/
|
|
Continuous
|
|
};
|
|
|
|
RawEvent(
|
|
std::string type,
|
|
ValueFactory payloadFactory,
|
|
SharedEventTarget eventTarget,
|
|
Category category = Category::Unspecified);
|
|
|
|
std::string type;
|
|
ValueFactory payloadFactory;
|
|
SharedEventTarget eventTarget;
|
|
Category category;
|
|
};
|
|
|
|
} // namespace react
|
|
} // namespace facebook
|