Skip to content

Commit

Permalink
πŸ’š fix Android build regression (#2595)
Browse files Browse the repository at this point in the history
  • Loading branch information
wcandillon authored Aug 27, 2024
1 parent fcbcf28 commit 00ea5da
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions package/android/cpp/jni/JniSkiaManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@

namespace {

#ifdef REACT_NATIVE_VERSION >= 75
using CallFuncType = facebook::react::CallFunc;
#else
using CallFuncType = std::function<void()>;
#endif

// For bridgeless mode, currently we don't have a way to get the JSCallInvoker
// from Java. Workaround to use RuntimeExecutor to simulate the behavior of
// JSCallInvoker. In the future when bridgeless mode is a standard and no more
Expand All @@ -20,7 +26,7 @@ class BridgelessJSCallInvoker : public facebook::react::CallInvoker {
facebook::react::RuntimeExecutor runtimeExecutor)
: runtimeExecutor_(std::move(runtimeExecutor)) {}

void invokeAsync(facebook::react::CallFunc &&func) noexcept override {
void invokeAsync(CallFuncType &&func) noexcept override {
runtimeExecutor_([func = std::move(func)](facebook::jsi::Runtime &runtime) {
#if REACT_NATIVE_VERSION >= 75
func(runtime);
Expand All @@ -30,7 +36,7 @@ class BridgelessJSCallInvoker : public facebook::react::CallInvoker {
});
}

void invokeSync(facebook::react::CallFunc &&func) override {
void invokeSync(CallFuncType &&func) override {
throw std::runtime_error(
"Synchronous native -> JS calls are currently not supported.");
}
Expand Down

0 comments on commit 00ea5da

Please sign in to comment.