Skip to content

Commit

Permalink
more verbose comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Isaac Garfinkle committed Jan 9, 2024
1 parent 6a7d884 commit 9759572
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -667,9 +667,16 @@ jsi::Value UIManagerBinding::get(
const jsi::Value &thisVal,
const jsi::Value *args,
size_t count) {
// We return onSuccessFunction out of the onFail
// instead of using the one defined above to avoid
// a scoping bug.
// There's a bug that occurs if, below, we try to
// call the onSuccessFunction we extracted
// earlier. It seems that JSIFunctions can't be
// passed into capture clauses for c++ anonymous
// functions, because they lack the appropriate
// copy constructor. Since we do definitely need
// access to the onSuccessFunction, we obtain that
// access by passing it into the .call() above and
// then passing it BACK OUT in native land, so we
// can extract it from args and use it right here.
auto onSuccessFunction =
args[0].getObject(rt).getFunction(rt);
measureFromShadowTree(
Expand Down Expand Up @@ -727,9 +734,16 @@ jsi::Value UIManagerBinding::get(
const jsi::Value &thisVal,
const jsi::Value *args,
size_t count) {
// We return onSuccessFunction out of the onFail
// instead of using the one defined above to avoid
// a scoping bug.
// There's a bug that occurs if, below, we try to
// call the onSuccessFunction we extracted
// earlier. It seems that JSIFunctions can't be
// passed into capture clauses for c++ anonymous
// functions, because they lack the appropriate
// copy constructor. Since we do definitely need
// access to the onSuccessFunction, we obtain that
// access by passing it into the .call() above and
// then passing it BACK OUT in native land, so we
// can extract it from args and use it right here.
auto onSuccessFunction =
args[0].getObject(rt).getFunction(rt);
measureInWindowFromShadowTree(
Expand Down

0 comments on commit 9759572

Please sign in to comment.