From c1e04948055c442a255dfb86bd09ec00e97e26a2 Mon Sep 17 00:00:00 2001 From: Wojciech Lewicki Date: Thu, 25 Jul 2024 16:03:12 +0200 Subject: [PATCH] feat: update patches --- ...ive-live-markdown+0.1.103+001+intial.patch | 13 ------ ...down+0.1.103+002+text-layout-manager.patch | 42 +++++++++++++++---- ...0-rc.4+013+fixTextCompilationSymbols.patch | 13 ++++++ patches/react-native-animatable+1.3.3.patch | 23 ++++++++++ ...ted+3.13.0+003+dontWhitelistTextProp.patch | 12 ++++++ 5 files changed, 81 insertions(+), 22 deletions(-) create mode 100644 patches/react-native+0.75.0-rc.4+013+fixTextCompilationSymbols.patch create mode 100644 patches/react-native-animatable+1.3.3.patch create mode 100644 patches/react-native-reanimated+3.13.0+003+dontWhitelistTextProp.patch diff --git a/patches/@expensify+react-native-live-markdown+0.1.103+001+intial.patch b/patches/@expensify+react-native-live-markdown+0.1.103+001+intial.patch index a051163693da..4e59d206268e 100644 --- a/patches/@expensify+react-native-live-markdown+0.1.103+001+intial.patch +++ b/patches/@expensify+react-native-live-markdown+0.1.103+001+intial.patch @@ -1,16 +1,3 @@ -diff --git a/node_modules/@expensify/react-native-live-markdown/android/src/main/java/com/expensify/livemarkdown/CustomMountingManager.java b/node_modules/@expensify/react-native-live-markdown/android/src/main/java/com/expensify/livemarkdown/CustomMountingManager.java -index 1b4381b..c7f6ad6 100644 ---- a/node_modules/@expensify/react-native-live-markdown/android/src/main/java/com/expensify/livemarkdown/CustomMountingManager.java -+++ b/node_modules/@expensify/react-native-live-markdown/android/src/main/java/com/expensify/livemarkdown/CustomMountingManager.java -@@ -21,7 +21,7 @@ import com.facebook.react.fabric.mounting.MountingManager; - 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.internal.span.TextInlineViewPlaceholderSpan; - import com.facebook.react.views.text.TextLayoutManagerMapBuffer; - import com.facebook.yoga.YogaMeasureMode; - import com.facebook.yoga.YogaMeasureOutput; diff --git a/node_modules/@expensify/react-native-live-markdown/android/src/main/java/com/expensify/livemarkdown/LiveMarkdownModule.java b/node_modules/@expensify/react-native-live-markdown/android/src/main/java/com/expensify/livemarkdown/LiveMarkdownModule.java index ed1428b..80641ce 100644 --- a/node_modules/@expensify/react-native-live-markdown/android/src/main/java/com/expensify/livemarkdown/LiveMarkdownModule.java diff --git a/patches/@expensify+react-native-live-markdown+0.1.103+002+text-layout-manager.patch b/patches/@expensify+react-native-live-markdown+0.1.103+002+text-layout-manager.patch index b21cb50d6867..24f327649253 100644 --- a/patches/@expensify+react-native-live-markdown+0.1.103+002+text-layout-manager.patch +++ b/patches/@expensify+react-native-live-markdown+0.1.103+002+text-layout-manager.patch @@ -1,17 +1,27 @@ diff --git a/node_modules/@expensify/react-native-live-markdown/android/src/main/java/com/expensify/livemarkdown/CustomMountingManager.java b/node_modules/@expensify/react-native-live-markdown/android/src/main/java/com/expensify/livemarkdown/CustomMountingManager.java -index c7f6ad6..7b535b7 100644 +index 1b4381b..7e3aebe 100644 --- a/node_modules/@expensify/react-native-live-markdown/android/src/main/java/com/expensify/livemarkdown/CustomMountingManager.java +++ b/node_modules/@expensify/react-native-live-markdown/android/src/main/java/com/expensify/livemarkdown/CustomMountingManager.java -@@ -22,7 +22,7 @@ import com.facebook.react.uimanager.PixelUtil; +@@ -13,7 +13,6 @@ import android.text.TextPaint; + import androidx.annotation.NonNull; + import androidx.annotation.Nullable; + +-import com.facebook.common.logging.FLog; + import com.facebook.react.bridge.ReactContext; + import com.facebook.react.bridge.ReadableMap; + import com.facebook.react.common.mapbuffer.MapBuffer; +@@ -21,8 +20,8 @@ import com.facebook.react.fabric.mounting.MountingManager; + 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.internal.span.TextInlineViewPlaceholderSpan; +-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.react.views.text.TextLayoutManager; import com.facebook.yoga.YogaMeasureMode; import com.facebook.yoga.YogaMeasureOutput; -@@ -63,7 +63,7 @@ public class CustomMountingManager extends MountingManager { +@@ -63,7 +62,7 @@ public class CustomMountingManager extends MountingManager { @Nullable float[] attachmentsPositions) { Spannable text = @@ -20,7 +30,7 @@ index c7f6ad6..7b535b7 100644 if (text == null) { return 0; -@@ -71,14 +71,14 @@ public class CustomMountingManager extends MountingManager { +@@ -71,14 +70,14 @@ public class CustomMountingManager extends MountingManager { int textBreakStrategy = TextAttributeProps.getTextBreakStrategy( @@ -39,17 +49,31 @@ index c7f6ad6..7b535b7 100644 // StaticLayout returns wrong metrics for the last line if it's empty, add something to the // last line so it's measured correctly -@@ -93,7 +93,7 @@ public class CustomMountingManager extends MountingManager { +@@ -89,13 +88,15 @@ public class CustomMountingManager extends MountingManager { + text = sb; + } + ++ Layout.Alignment alignment = TextLayoutManager.getTextAlignment(attributedString, text); ++ + markdownUtils.applyMarkdownFormatting((SpannableStringBuilder)text); BoringLayout.Metrics boring = BoringLayout.isBoring(text, sTextPaintInstance); - Class mapBufferClass = TextLayoutManagerMapBuffer.class; + Class mapBufferClass = TextLayoutManager.class; try { - Method createLayoutMethod = mapBufferClass.getDeclaredMethod("createLayout", Spannable.class, BoringLayout.Metrics.class, float.class, YogaMeasureMode.class, boolean.class, int.class, int.class); +- Method createLayoutMethod = mapBufferClass.getDeclaredMethod("createLayout", Spannable.class, BoringLayout.Metrics.class, float.class, YogaMeasureMode.class, boolean.class, int.class, int.class); ++ Method createLayoutMethod = mapBufferClass.getDeclaredMethod("createLayout", Spannable.class, BoringLayout.Metrics.class, float.class, YogaMeasureMode.class, boolean.class, int.class, int.class, Layout.Alignment.class); createLayoutMethod.setAccessible(true); -@@ -109,8 +109,8 @@ public class CustomMountingManager extends MountingManager { - hyphenationFrequency); + + Layout layout = (Layout)createLayoutMethod.invoke( +@@ -106,11 +107,12 @@ public class CustomMountingManager extends MountingManager { + widthYogaMeasureMode, + includeFontPadding, + textBreakStrategy, +- hyphenationFrequency); ++ hyphenationFrequency, ++ alignment); int maximumNumberOfLines = - paragraphAttributes.contains(TextLayoutManagerMapBuffer.PA_KEY_MAX_NUMBER_OF_LINES) diff --git a/patches/react-native+0.75.0-rc.4+013+fixTextCompilationSymbols.patch b/patches/react-native+0.75.0-rc.4+013+fixTextCompilationSymbols.patch new file mode 100644 index 000000000000..4ffa2d5295ab --- /dev/null +++ b/patches/react-native+0.75.0-rc.4+013+fixTextCompilationSymbols.patch @@ -0,0 +1,13 @@ +diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/textinput/CMakeLists.txt b/node_modules/react-native/ReactCommon/react/renderer/components/textinput/CMakeLists.txt +index 9881461..c311a05 100644 +--- a/node_modules/react-native/ReactCommon/react/renderer/components/textinput/CMakeLists.txt ++++ b/node_modules/react-native/ReactCommon/react/renderer/components/textinput/CMakeLists.txt +@@ -15,7 +15,7 @@ add_compile_options( + -DLOG_TAG=\"Fabric\") + + file(GLOB rrc_textinput_SRC CONFIGURE_DEPENDS *.cpp platform/android/react/renderer/components/androidtextinput/*.cpp) +-add_library(rrc_textinput STATIC ${rrc_textinput_SRC}) ++add_library(rrc_textinput SHARED ${rrc_textinput_SRC}) + + target_include_directories(rrc_textinput PUBLIC . ${CMAKE_CURRENT_SOURCE_DIR}/platform/android/) + diff --git a/patches/react-native-animatable+1.3.3.patch b/patches/react-native-animatable+1.3.3.patch new file mode 100644 index 000000000000..ebb4398342c1 --- /dev/null +++ b/patches/react-native-animatable+1.3.3.patch @@ -0,0 +1,23 @@ +diff --git a/node_modules/react-native-animatable/createAnimatableComponent.js b/node_modules/react-native-animatable/createAnimatableComponent.js +index 2847e12..331d44f 100644 +--- a/node_modules/react-native-animatable/createAnimatableComponent.js ++++ b/node_modules/react-native-animatable/createAnimatableComponent.js +@@ -465,7 +465,9 @@ export default function createAnimatableComponent(WrappedComponent) { + const needsZeroClamping = + ZERO_CLAMPED_STYLE_PROPERTIES.indexOf(property) !== -1; + if (needsInterpolation) { +- transitionValue.setValue(0); ++ transitionValue = new Animated.Value(0); ++ transitionValues[property] = transitionValue; ++ + transitionStyle[property] = transitionValue.interpolate({ + inputRange: [0, 1], + outputRange: [fromValue, toValue], +@@ -546,7 +548,6 @@ export default function createAnimatableComponent(WrappedComponent) { + transitions.to[property] = toValue; + } + }); +- + if (Object.keys(transitions.from).length) { + this.transition(transitions.from, transitions.to, duration, easing); + } diff --git a/patches/react-native-reanimated+3.13.0+003+dontWhitelistTextProp.patch b/patches/react-native-reanimated+3.13.0+003+dontWhitelistTextProp.patch new file mode 100644 index 000000000000..4ba96ac8659f --- /dev/null +++ b/patches/react-native-reanimated+3.13.0+003+dontWhitelistTextProp.patch @@ -0,0 +1,12 @@ +diff --git a/node_modules/react-native-reanimated/src/component/PerformanceMonitor.tsx b/node_modules/react-native-reanimated/src/component/PerformanceMonitor.tsx +index 9e66803..3620fe9 100644 +--- a/node_modules/react-native-reanimated/src/component/PerformanceMonitor.tsx ++++ b/node_modules/react-native-reanimated/src/component/PerformanceMonitor.tsx +@@ -47,7 +47,6 @@ function createCircularDoublesBuffer(size: number) { + } + + const DEFAULT_BUFFER_SIZE = 60; +-addWhitelistedNativeProps({ text: true }); + const AnimatedTextInput = createAnimatedComponent(TextInput); + + function loopAnimationFrame(fn: (lastTime: number, time: number) => void) {