Skip to content

Commit

Permalink
Fix Android build on new arch
Browse files Browse the repository at this point in the history
  • Loading branch information
tomekzaw committed May 27, 2024
1 parent 834c741 commit 829d517
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 145 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import com.facebook.react.uimanager.PixelUtil;
import com.facebook.react.uimanager.ViewManagerRegistry;
import com.facebook.react.views.text.TextAttributeProps;
import com.facebook.react.views.text.TextInlineViewPlaceholderSpan;
import com.facebook.react.views.text.TextLayoutManagerMapBuffer;
import com.facebook.react.views.text.internal.span.TextInlineViewPlaceholderSpan;
import com.facebook.yoga.YogaMeasureMode;
import com.facebook.yoga.YogaMeasureOutput;

Expand All @@ -44,7 +44,7 @@ public CustomMountingManager(

AssetManager assetManager = context.getAssets();
MarkdownUtils.maybeInitializeRuntime(assetManager);

this.markdownUtils = new MarkdownUtils(assetManager);
this.markdownUtils.setMarkdownStyle(new MarkdownStyle(decoratorProps, context));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.expensify.livemarkdown;

import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.UIManager;
import com.facebook.react.fabric.FabricUIManager;
import com.facebook.react.uimanager.UIManagerHelper;
import com.facebook.react.uimanager.common.UIManagerType;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
package com.expensify.livemarkdown;

import static com.facebook.infer.annotation.ThreadConfined.UI;

import android.content.res.AssetManager;
import android.text.SpannableStringBuilder;
import android.text.Spanned;

import androidx.annotation.NonNull;

import com.facebook.infer.annotation.Assertions;
import com.facebook.infer.annotation.ThreadConfined;
import com.facebook.react.bridge.UiThreadUtil;
import com.facebook.react.views.text.CustomLineHeightSpan;
import com.facebook.react.views.text.internal.span.CustomLineHeightSpan;
import com.facebook.soloader.SoLoader;

import org.json.JSONArray;
Expand Down
6 changes: 4 additions & 2 deletions android/src/main/new_arch/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ set(RN_DIR ${LIB_ANDROID_DIR}/../example/node_modules/react-native)

add_library(
${LIB_TARGET_NAME}
SHARED
SHARED
${LIB_MODULE_SRCS}
${LIB_CUSTOM_SRCS}
${LIB_CODEGEN_SRCS}
Expand All @@ -42,6 +42,8 @@ target_link_libraries(
ReactAndroid::rrc_textinput
ReactAndroid::react_render_textlayoutmanager
ReactAndroid::react_render_imagemanager
ReactAndroid::reactnativejni
ReactAndroid::mapbufferjni
fabricjni
fbjni
folly_runtime
Expand Down Expand Up @@ -79,4 +81,4 @@ target_include_directories(
${CMAKE_PROJECT_NAME}
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
)
)
39 changes: 0 additions & 39 deletions example/patches/@react-native+gradle-plugin+0.73.4.patch

This file was deleted.

95 changes: 0 additions & 95 deletions example/patches/react-native+0.73.4.patch

This file was deleted.

49 changes: 49 additions & 0 deletions example/patches/react-native+0.74.1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
diff --git a/node_modules/react-native/ReactAndroid/build.gradle.kts b/node_modules/react-native/ReactAndroid/build.gradle.kts
index 4909aed..b1cfd32 100644
--- a/node_modules/react-native/ReactAndroid/build.gradle.kts
+++ b/node_modules/react-native/ReactAndroid/build.gradle.kts
@@ -155,6 +155,8 @@ val preparePrefab by
"glog", Pair(File(buildDir, "third-party-ndk/glog/exported/").absolutePath, "")),
PrefabPreprocessingEntry(
"fabricjni", Pair("src/main/jni/react/fabric", "react/fabric/")),
+ PrefabPreprocessingEntry(
+ "mapbufferjni", Pair("src/main/jni/react/mapbuffer", "react/mapbuffer/")),
PrefabPreprocessingEntry(
"react_render_mapbuffer",
Pair("../ReactCommon/react/renderer/mapbuffer/", "react/renderer/mapbuffer/")),
@@ -574,6 +576,7 @@ android {
"jsi",
"glog",
"fabricjni",
+ "mapbufferjni",
"react_render_mapbuffer",
"react_render_textlayoutmanager",
"yoga",
@@ -703,6 +706,7 @@ android {
create("jsi") { headers = File(prefabHeadersDir, "jsi").absolutePath }
create("glog") { headers = File(prefabHeadersDir, "glog").absolutePath }
create("fabricjni") { headers = File(prefabHeadersDir, "fabricjni").absolutePath }
+ create("mapbufferjni") { headers = File(prefabHeadersDir, "mapbufferjni").absolutePath }
create("react_render_mapbuffer") {
headers = File(prefabHeadersDir, "react_render_mapbuffer").absolutePath
}
diff --git a/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake b/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake
index e2efc26..3d4e151 100644
--- a/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake
+++ b/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake
@@ -79,6 +79,7 @@ add_library(rrc_textinput ALIAS ReactAndroid::rrc_textinput)
add_library(jsi ALIAS ReactAndroid::jsi)
add_library(glog ALIAS ReactAndroid::glog)
add_library(fabricjni ALIAS ReactAndroid::fabricjni)
+add_library(mapbufferjni ALIAS ReactAndroid::mapbufferjni)
add_library(react_render_mapbuffer ALIAS ReactAndroid::react_render_mapbuffer)
add_library(react_render_textlayoutmanager ALIAS ReactAndroid::react_render_textlayoutmanager)
add_library(yoga ALIAS ReactAndroid::yoga)
@@ -93,6 +94,7 @@ add_library(fbjni ALIAS fbjni::fbjni)

target_link_libraries(${CMAKE_PROJECT_NAME}
fabricjni # prefab ready
+ mapbufferjni # prefab ready
fbjni # via 3rd party prefab
folly_runtime # prefab ready
glog # prefab ready

0 comments on commit 829d517

Please sign in to comment.