Skip to content

Commit

Permalink
fix(🤖): Fix Android build on 0.75 (#2586)
Browse files Browse the repository at this point in the history
  • Loading branch information
wcandillon authored Aug 22, 2024
1 parent 9de8da3 commit 8e4bc1e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
2 changes: 2 additions & 0 deletions package/android/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ else()
endif()
message("-- TURBO : " ${TURBOMODULES_LIB})

add_definitions(-DREACT_NATIVE_VERSION=${REACT_NATIVE_VERSION})

# Link
target_link_libraries(
${PACKAGE_NAME}
Expand Down
6 changes: 4 additions & 2 deletions package/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,15 @@ android {
]
}

if (REACT_NATIVE_VERSION >= 74) {
if (REACT_NATIVE_VERSION == 74) {
srcDirs += [
"src/reactnative74/java"
]
} else {
// the name latest here might be confusing as it applies for versions
// below 74 as well
srcDirs += [
"src/reactnative69/java"
"src/latest/java"
]
}
}
Expand Down
13 changes: 9 additions & 4 deletions package/android/cpp/jni/JniSkiaManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,17 @@ class BridgelessJSCallInvoker : public facebook::react::CallInvoker {
facebook::react::RuntimeExecutor runtimeExecutor)
: runtimeExecutor_(std::move(runtimeExecutor)) {}

void invokeAsync(std::function<void()> &&func) noexcept override {
runtimeExecutor_(
[func = std::move(func)](facebook::jsi::Runtime &runtime) { func(); });
void invokeAsync(facebook::react::CallFunc &&func) noexcept override {
runtimeExecutor_([func = std::move(func)](facebook::jsi::Runtime &runtime) {
#if REACT_NATIVE_VERSION >= 75
func(runtime);
#else
func();
#endif
});
}

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

0 comments on commit 8e4bc1e

Please sign in to comment.