Files
react-native/ReactCommon/react/renderer/core/ReactEventPriority.h
T
Samuel Susla 1866566d52 Introduce a way to specify React priority for events
Summary:
Changelog: [internal]

Introduce a way to specify React priority for events.
These APIs will be called from React here: https://github.com/facebook/react/blob/0e100ed00fb52cfd107db1d1081ef18fe4b9167f/packages/react-native-renderer/src/ReactFabricHostConfig.js#L345

React does similar thing on the web: https://github.com/facebook/react/blob/8ea11306ad473b26a2c899ef7a893d25413f3510/packages/react-dom/src/client/ReactDOMHostConfig.js#L378

Take a look at D28483983 that shows how React will be calling these APIs.

Reviewed By: JoshuaGross

Differential Revision: D28481260

fbshipit-source-id: c965a8aa0ba5192246c216046d49bcb046152a5a
2021-05-25 01:16:04 -07:00

44 lines
931 B
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
namespace facebook {
namespace react {
/*
* An enum that represents React's event priority.
* Used to map Fabric events to React.
*/
enum class ReactEventPriority {
/*
* Event priority is unspecified.
*/
Default,
/*
* User events that happen at discrete times, like
* input into text field.
*/
Discrete,
/*
* “fluid” user events that happen many times over a short period of time like
* scrolling.
*/
Continuous,
};
static constexpr std::underlying_type<ReactEventPriority>::type serialize(
ReactEventPriority reactEventPriority) {
return static_cast<std::underlying_type<ReactEventPriority>::type>(
reactEventPriority);
}
} // namespace react
} // namespace facebook