mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Make normalizeEventType public (#45900)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/45900 Changelog: [internal] make `normalizeEventType` public, it looks like a nice util when we want to write code to intercept event, e.g. "scroll" event could be named as "onScroll" or "topScroll", this function contains the source of truth of how RN parses it Reviewed By: christophpurrer Differential Revision: D60767388 fbshipit-source-id: b3880fda57e2d92d9d199db5f5d39b8a8435820c
This commit is contained in:
committed by
Facebook GitHub Bot
parent
b0b898b460
commit
67367a0bba
@@ -26,7 +26,7 @@ static bool hasPrefix(const std::string& str, const std::string& prefix) {
|
||||
* "top" prefix. E.g. "eventName" becomes "topEventName", "onEventName" also
|
||||
* becomes "topEventName".
|
||||
*/
|
||||
static std::string normalizeEventType(std::string type) {
|
||||
/* static */ std::string EventEmitter::normalizeEventType(std::string type) {
|
||||
auto prefixedType = std::move(type);
|
||||
if (facebook::react::hasPrefix(prefixedType, "top")) {
|
||||
return prefixedType;
|
||||
|
||||
@@ -33,6 +33,8 @@ class EventEmitter {
|
||||
public:
|
||||
using Shared = std::shared_ptr<const EventEmitter>;
|
||||
|
||||
static std::string normalizeEventType(std::string type);
|
||||
|
||||
static std::mutex& DispatchMutex();
|
||||
|
||||
static ValueFactory defaultPayloadFactory();
|
||||
|
||||
Reference in New Issue
Block a user