Skip to content

Commit

Permalink
Make normalizeEventType public (facebook#45900)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#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
  • Loading branch information
zeyap authored and facebook-github-bot committed Aug 6, 2024
1 parent b0b898b commit 67367a0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 67367a0

Please sign in to comment.