From fa899cb51fd02db52a316495cda3408920244eb9 Mon Sep 17 00:00:00 2001 From: Samuel Susla Date: Tue, 25 May 2021 09:55:22 -0700 Subject: [PATCH] Use getter instead of directly accessing ivar Summary: Changelog: [internal] Use getter function instead of accessing ivar. This makes for clearer APIs. React part is implemented in https://github.com/facebook/react/pull/21553 Reviewed By: JoshuaGross Differential Revision: D28675372 fbshipit-source-id: cf99f8482067bfc0fd57d39fda9656abd665bb69 --- .../react/renderer/uimanager/UIManagerBinding.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp b/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp index c873c7f9687..b6fc4401586 100644 --- a/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp +++ b/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp @@ -777,8 +777,18 @@ jsi::Value UIManagerBinding::get( }); } - if (methodName == "unstable_currentEventPriority") { - return jsi::Value(serialize(currentEventPriority_)); + if (methodName == "unstable_getCurrentEventPriority") { + return jsi::Function::createFromHostFunction( + runtime, + name, + 0, + [this]( + jsi::Runtime &, + jsi::Value const &, + jsi::Value const *, + size_t) noexcept -> jsi::Value { + return jsi::Value(serialize(currentEventPriority_)); + }); } if (methodName == "unstable_DefaultEventPriority") {