TM Android: fixed up JSCallInvoker creation

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
This commit is contained in:
Kevin Gozali
2019-04-03 13:19:17 -07:00
committed by Facebook Github Bot
parent 99ec3dc845
commit 1e2e07da2c
2 changed files with 5 additions and 1 deletions

View File

@@ -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"),
],
)

View File

@@ -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>
@@ -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);
})
);