Skip to content

Commit

Permalink
TM Android: fixed up JSCallInvoker creation
Browse files Browse the repository at this point in the history
Summary: A previous commit changed the signature of the Instance (the arg to JSCallInvoker) to be a weak ref, so this callsite needs updating.

Reviewed By: mmmulani

Differential Revision: D14757188

fbshipit-source-id: 1a8663e56a42b26c6202881c57a7caafa71da2ab
  • Loading branch information
fkgozali authored and facebook-github-bot committed Apr 3, 2019
1 parent 99ec3dc commit 1e2e07d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ rn_xplat_cxx_library(
],
exported_deps = [
"fbsource//xplat/jsi:jsi",
react_native_xplat_target("cxxreact:bridge"),
react_native_xplat_target("turbomodule/core:core"),
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <fb/fbjni.h>
#include <jsi/jsi.h>

#include <cxxreact/Instance.h>
#include <jsireact/TurboModuleBinding.h>

#include <react/jni/JMessageQueueThread.h>
Expand Down Expand Up @@ -56,7 +57,9 @@ void TurboModuleManager::installJSIBindings() {
[this](const std::string &name) {
const auto moduleInstance = getJavaModule(name);
// TODO: Pass in react Instance to JSCallInvoker instead.
const auto jsInvoker = std::make_shared<react::JSCallInvoker>(nullptr);
std::shared_ptr<Instance> instance = nullptr;
std::weak_ptr<Instance> weakInstance = instance;
const auto jsInvoker = std::make_shared<react::JSCallInvoker>(weakInstance);
return moduleProvider_(name, moduleInstance, jsInvoker);
})
);
Expand Down

0 comments on commit 1e2e07d

Please sign in to comment.