@expensify/react-native-live-markdown 0.1.128 → 0.1.129

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,7 +13,6 @@ import android.text.TextPaint;
13
13
  import androidx.annotation.NonNull;
14
14
  import androidx.annotation.Nullable;
15
15
 
16
- import com.facebook.common.logging.FLog;
17
16
  import com.facebook.react.bridge.ReactContext;
18
17
  import com.facebook.react.bridge.ReadableMap;
19
18
  import com.facebook.react.common.mapbuffer.MapBuffer;
@@ -21,7 +20,7 @@ import com.facebook.react.fabric.mounting.MountingManager;
21
20
  import com.facebook.react.uimanager.PixelUtil;
22
21
  import com.facebook.react.uimanager.ViewManagerRegistry;
23
22
  import com.facebook.react.views.text.TextAttributeProps;
24
- import com.facebook.react.views.text.TextLayoutManagerMapBuffer;
23
+ import com.facebook.react.views.text.TextLayoutManager;
25
24
  import com.facebook.react.views.text.internal.span.TextInlineViewPlaceholderSpan;
26
25
  import com.facebook.yoga.YogaMeasureMode;
27
26
  import com.facebook.yoga.YogaMeasureOutput;
@@ -63,7 +62,7 @@ public class CustomMountingManager extends MountingManager {
63
62
  @Nullable float[] attachmentsPositions) {
64
63
 
65
64
  Spannable text =
66
- TextLayoutManagerMapBuffer.getOrCreateSpannableForText(context, attributedString, null);
65
+ TextLayoutManager.getOrCreateSpannableForText(context, attributedString, null);
67
66
 
68
67
  if (text == null) {
69
68
  return 0;
@@ -71,14 +70,14 @@ public class CustomMountingManager extends MountingManager {
71
70
 
72
71
  int textBreakStrategy =
73
72
  TextAttributeProps.getTextBreakStrategy(
74
- paragraphAttributes.getString(TextLayoutManagerMapBuffer.PA_KEY_TEXT_BREAK_STRATEGY));
73
+ paragraphAttributes.getString(TextLayoutManager.PA_KEY_TEXT_BREAK_STRATEGY));
75
74
  boolean includeFontPadding =
76
- paragraphAttributes.contains(TextLayoutManagerMapBuffer.PA_KEY_INCLUDE_FONT_PADDING)
77
- ? paragraphAttributes.getBoolean(TextLayoutManagerMapBuffer.PA_KEY_INCLUDE_FONT_PADDING)
75
+ paragraphAttributes.contains(TextLayoutManager.PA_KEY_INCLUDE_FONT_PADDING)
76
+ ? paragraphAttributes.getBoolean(TextLayoutManager.PA_KEY_INCLUDE_FONT_PADDING)
78
77
  : DEFAULT_INCLUDE_FONT_PADDING;
79
78
  int hyphenationFrequency =
80
79
  TextAttributeProps.getHyphenationFrequency(
81
- paragraphAttributes.getString(TextLayoutManagerMapBuffer.PA_KEY_HYPHENATION_FREQUENCY));
80
+ paragraphAttributes.getString(TextLayoutManager.PA_KEY_HYPHENATION_FREQUENCY));
82
81
 
83
82
  // StaticLayout returns wrong metrics for the last line if it's empty, add something to the
84
83
  // last line so it's measured correctly
@@ -89,13 +88,15 @@ public class CustomMountingManager extends MountingManager {
89
88
  text = sb;
90
89
  }
91
90
 
91
+ Layout.Alignment alignment = TextLayoutManager.getTextAlignment(attributedString, text);
92
+
92
93
  markdownUtils.applyMarkdownFormatting((SpannableStringBuilder)text);
93
94
 
94
95
  BoringLayout.Metrics boring = BoringLayout.isBoring(text, sTextPaintInstance);
95
96
 
96
- Class<TextLayoutManagerMapBuffer> mapBufferClass = TextLayoutManagerMapBuffer.class;
97
+ Class<TextLayoutManager> mapBufferClass = TextLayoutManager.class;
97
98
  try {
98
- Method createLayoutMethod = mapBufferClass.getDeclaredMethod("createLayout", Spannable.class, BoringLayout.Metrics.class, float.class, YogaMeasureMode.class, boolean.class, int.class, int.class);
99
+ Method createLayoutMethod = mapBufferClass.getDeclaredMethod("createLayout", Spannable.class, BoringLayout.Metrics.class, float.class, YogaMeasureMode.class, boolean.class, int.class, int.class, Layout.Alignment.class);
99
100
  createLayoutMethod.setAccessible(true);
100
101
 
101
102
  Layout layout = (Layout)createLayoutMethod.invoke(
@@ -106,11 +107,12 @@ public class CustomMountingManager extends MountingManager {
106
107
  widthYogaMeasureMode,
107
108
  includeFontPadding,
108
109
  textBreakStrategy,
109
- hyphenationFrequency);
110
+ hyphenationFrequency,
111
+ alignment);
110
112
 
111
113
  int maximumNumberOfLines =
112
- paragraphAttributes.contains(TextLayoutManagerMapBuffer.PA_KEY_MAX_NUMBER_OF_LINES)
113
- ? paragraphAttributes.getInt(TextLayoutManagerMapBuffer.PA_KEY_MAX_NUMBER_OF_LINES)
114
+ paragraphAttributes.contains(TextLayoutManager.PA_KEY_MAX_NUMBER_OF_LINES)
115
+ ? paragraphAttributes.getInt(TextLayoutManager.PA_KEY_MAX_NUMBER_OF_LINES)
114
116
  : UNSET;
115
117
 
116
118
  int calculatedLineCount =
@@ -65,6 +65,12 @@ target_link_libraries(
65
65
  yoga
66
66
  android
67
67
  log
68
+ mapbufferjni
69
+ reactnativejni
70
+ react_render_consistency
71
+ react_performance_timeline
72
+ react_render_observers_events
73
+ react_featureflags
68
74
  )
69
75
 
70
76
  target_compile_options(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expensify/react-native-live-markdown",
3
- "version": "0.1.128",
3
+ "version": "0.1.129",
4
4
  "description": "Drop-in replacement for React Native's TextInput component with Markdown formatting.",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -65,7 +65,7 @@
65
65
  "@commitlint/config-conventional": "^17.0.2",
66
66
  "@evilmartians/lefthook": "^1.5.0",
67
67
  "@lwc/eslint-plugin-lwc": "^1.7.2",
68
- "@react-native/eslint-config": "^0.73.2",
68
+ "@react-native/eslint-config": "0.75.2",
69
69
  "@release-it/conventional-changelog": "^5.0.0",
70
70
  "@types/jest": "^28.1.2",
71
71
  "@types/react": "~17.0.21",
@@ -90,8 +90,8 @@
90
90
  "jest-environment-jsdom": "^29.7.0",
91
91
  "nodemon": "^3.1.3",
92
92
  "prettier": "2.8.8",
93
- "react": "18.2.0",
94
- "react-native": "0.74.5",
93
+ "react": "18.3.1",
94
+ "react-native": "0.75.2",
95
95
  "react-native-builder-bob": "^0.20.0",
96
96
  "react-native-web": "^0.19.10",
97
97
  "release-it": "^15.0.0",
@@ -100,8 +100,7 @@
100
100
  },
101
101
  "resolutions": {
102
102
  "@types/react": "17.0.21",
103
- "link@^2.1.1": "patch:link@npm%3A2.1.1#./.yarn/patches/link-npm-2.1.1-1c9fea076e.patch",
104
- "react-native@0.74.5": "patch:react-native@npm%3A0.74.5#./.yarn/patches/react-native-npm-0.74.5-3cfd406787.patch"
103
+ "link@^2.1.1": "patch:link@npm%3A2.1.1#./.yarn/patches/link-npm-2.1.1-1c9fea076e.patch"
105
104
  },
106
105
  "peerDependencies": {
107
106
  "react": "*",