Skip to content

Commit 8e4bc1e

Browse files
authored
fix(🤖): Fix Android build on 0.75 (#2586)
1 parent 9de8da3 commit 8e4bc1e

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

‎package/android/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,8 @@ else()
220220
endif()
221221
message("-- TURBO : " ${TURBOMODULES_LIB})
222222

223+
add_definitions(-DREACT_NATIVE_VERSION=${REACT_NATIVE_VERSION})
224+
223225
# Link
224226
target_link_libraries(
225227
${PACKAGE_NAME}

‎package/android/build.gradle

+4-2
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,15 @@ android {
172172
]
173173
}
174174

175-
if (REACT_NATIVE_VERSION >= 74) {
175+
if (REACT_NATIVE_VERSION == 74) {
176176
srcDirs += [
177177
"src/reactnative74/java"
178178
]
179179
} else {
180+
// the name latest here might be confusing as it applies for versions
181+
// below 74 as well
180182
srcDirs += [
181-
"src/reactnative69/java"
183+
"src/latest/java"
182184
]
183185
}
184186
}

‎package/android/cpp/jni/JniSkiaManager.cpp

+9-4
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,17 @@ class BridgelessJSCallInvoker : public facebook::react::CallInvoker {
2020
facebook::react::RuntimeExecutor runtimeExecutor)
2121
: runtimeExecutor_(std::move(runtimeExecutor)) {}
2222

23-
void invokeAsync(std::function<void()> &&func) noexcept override {
24-
runtimeExecutor_(
25-
[func = std::move(func)](facebook::jsi::Runtime &runtime) { func(); });
23+
void invokeAsync(facebook::react::CallFunc &&func) noexcept override {
24+
runtimeExecutor_([func = std::move(func)](facebook::jsi::Runtime &runtime) {
25+
#if REACT_NATIVE_VERSION >= 75
26+
func(runtime);
27+
#else
28+
func();
29+
#endif
30+
});
2631
}
2732

28-
void invokeSync(std::function<void()> &&func) override {
33+
void invokeSync(facebook::react::CallFunc &&func) override {
2934
throw std::runtime_error(
3035
"Synchronous native -> JS calls are currently not supported.");
3136
}

0 commit comments

Comments
 (0)