react-native 0.72.0-rc.5 → 0.72.0-rc.6

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.
Files changed (26) hide show
  1. package/Libraries/AppDelegate/React-RCTAppDelegate.podspec +2 -1
  2. package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +0 -1
  3. package/Libraries/Components/TextInput/TextInput.js +5 -20
  4. package/Libraries/Core/ReactNativeVersion.js +1 -1
  5. package/React/Base/RCTVersion.m +1 -1
  6. package/ReactAndroid/gradle.properties +1 -1
  7. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
  8. package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBaseTextShadowNode.java +5 -30
  9. package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextUpdate.java +3 -47
  10. package/ReactAndroid/src/main/java/com/facebook/react/views/text/SetSpanOperation.java +52 -0
  11. package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.java +5 -31
  12. package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManagerMapBuffer.java +5 -31
  13. package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java +8 -0
  14. package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java +7 -9
  15. package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputShadowNode.java +1 -31
  16. package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundDrawable.java +17 -14
  17. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  18. package/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputProps.cpp +0 -4
  19. package/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputProps.h +0 -34
  20. package/package.json +5 -5
  21. package/scripts/cocoapods/__tests__/utils-test.rb +54 -0
  22. package/scripts/cocoapods/utils.rb +12 -0
  23. package/scripts/react_native_pods.rb +1 -0
  24. package/sdks/hermesc/osx-bin/hermesc +0 -0
  25. package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
  26. package/template/package.json +1 -1
@@ -99,7 +99,8 @@ Pod::Spec.new do |s|
99
99
  s.script_phases = {
100
100
  :name => "Generate Legacy Components Interop",
101
101
  :script => "
102
- . ${PODS_ROOT}/../.xcode.env
102
+ WITH_ENVIRONMENT=\"$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh\"
103
+ source $WITH_ENVIRONMENT
103
104
  ${NODE_BINARY} ${REACT_NATIVE_PATH}/scripts/codegen/generate-legacy-interop-components.js -p #{ENV['APP_PATH']} -o ${REACT_NATIVE_PATH}/Libraries/AppDelegate
104
105
  ",
105
106
  :execution_position => :before_compile,
@@ -692,7 +692,6 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig = {
692
692
  fontStyle: true,
693
693
  textShadowOffset: true,
694
694
  selectionColor: {process: require('../../StyleSheet/processColor').default},
695
- selection: true,
696
695
  placeholderTextColor: {
697
696
  process: require('../../StyleSheet/processColor').default,
698
697
  },
@@ -1066,27 +1066,19 @@ function InternalTextInput(props: Props): React.Node {
1066
1066
  accessibilityState,
1067
1067
  id,
1068
1068
  tabIndex,
1069
+ selection: propsSelection,
1069
1070
  ...otherProps
1070
1071
  } = props;
1071
1072
 
1072
1073
  const inputRef = useRef<null | React.ElementRef<HostComponent<mixed>>>(null);
1073
1074
 
1074
- // Android sends a "onTextChanged" event followed by a "onSelectionChanged" event, for
1075
- // the same "most recent event count".
1076
- // For controlled selection, that means that immediately after text is updated,
1077
- // a controlled component will pass in the *previous* selection, even if the controlled
1078
- // component didn't mean to modify the selection at all.
1079
- // Therefore, we ignore selections and pass them through until the selection event has
1080
- // been sent.
1081
- // Note that this mitigation is NOT needed for Fabric.
1082
- // discovered when upgrading react-hooks
1083
1075
  // eslint-disable-next-line react-hooks/exhaustive-deps
1084
- let selection: ?Selection =
1085
- props.selection == null
1076
+ const selection: ?Selection =
1077
+ propsSelection == null
1086
1078
  ? null
1087
1079
  : {
1088
- start: props.selection.start,
1089
- end: props.selection.end ?? props.selection.start,
1080
+ start: propsSelection.start,
1081
+ end: propsSelection.end ?? propsSelection.start,
1090
1082
  };
1091
1083
 
1092
1084
  const [mostRecentEventCount, setMostRecentEventCount] = useState<number>(0);
@@ -1098,12 +1090,6 @@ function InternalTextInput(props: Props): React.Node {
1098
1090
  |}>({selection, mostRecentEventCount});
1099
1091
 
1100
1092
  const lastNativeSelection = lastNativeSelectionState.selection;
1101
- const lastNativeSelectionEventCount =
1102
- lastNativeSelectionState.mostRecentEventCount;
1103
-
1104
- if (lastNativeSelectionEventCount < mostRecentEventCount) {
1105
- selection = null;
1106
- }
1107
1093
 
1108
1094
  let viewCommands;
1109
1095
  if (AndroidTextInputCommands) {
@@ -1503,7 +1489,6 @@ function InternalTextInput(props: Props): React.Node {
1503
1489
  onScroll={_onScroll}
1504
1490
  onSelectionChange={_onSelectionChange}
1505
1491
  placeholder={placeholder}
1506
- selection={selection}
1507
1492
  style={style}
1508
1493
  text={text}
1509
1494
  textBreakStrategy={props.textBreakStrategy}
@@ -13,5 +13,5 @@ exports.version = {
13
13
  major: 0,
14
14
  minor: 72,
15
15
  patch: 0,
16
- prerelease: 'rc.5',
16
+ prerelease: 'rc.6',
17
17
  };
@@ -24,7 +24,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(72),
26
26
  RCTVersionPatch: @(0),
27
- RCTVersionPrerelease: @"rc.5",
27
+ RCTVersionPrerelease: @"rc.6",
28
28
  };
29
29
  });
30
30
  return __rnVersion;
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.72.0-rc.5
1
+ VERSION_NAME=0.72.0-rc.6
2
2
  GROUP=com.facebook.react
3
3
 
4
4
  # JVM Versions
@@ -18,5 +18,5 @@ public class ReactNativeVersion {
18
18
  "major", 0,
19
19
  "minor", 72,
20
20
  "patch", 0,
21
- "prerelease", "rc.5");
21
+ "prerelease", "rc.6");
22
22
  }
@@ -69,31 +69,6 @@ public abstract class ReactBaseTextShadowNode extends LayoutShadowNode {
69
69
 
70
70
  protected @Nullable ReactTextViewManagerCallback mReactTextViewManagerCallback;
71
71
 
72
- private static class SetSpanOperation {
73
- protected int start, end;
74
- protected ReactSpan what;
75
-
76
- SetSpanOperation(int start, int end, ReactSpan what) {
77
- this.start = start;
78
- this.end = end;
79
- this.what = what;
80
- }
81
-
82
- public void execute(SpannableStringBuilder sb, int priority) {
83
- // All spans will automatically extend to the right of the text, but not the left - except
84
- // for spans that start at the beginning of the text.
85
- int spanFlags = Spannable.SPAN_EXCLUSIVE_INCLUSIVE;
86
- if (start == 0) {
87
- spanFlags = Spannable.SPAN_INCLUSIVE_INCLUSIVE;
88
- }
89
-
90
- spanFlags &= ~Spannable.SPAN_PRIORITY;
91
- spanFlags |= (priority << Spannable.SPAN_PRIORITY_SHIFT) & Spannable.SPAN_PRIORITY;
92
-
93
- sb.setSpan(what, start, end, spanFlags);
94
- }
95
- }
96
-
97
72
  private static void buildSpannedFromShadowNode(
98
73
  ReactBaseTextShadowNode textShadowNode,
99
74
  SpannableStringBuilder sb,
@@ -276,8 +251,9 @@ public abstract class ReactBaseTextShadowNode extends LayoutShadowNode {
276
251
 
277
252
  // While setting the Spans on the final text, we also check whether any of them are inline views
278
253
  // or images.
279
- int priority = 0;
280
- for (SetSpanOperation op : ops) {
254
+ for (int priorityIndex = 0; priorityIndex < ops.size(); priorityIndex++) {
255
+ final SetSpanOperation op = ops.get(ops.size() - priorityIndex - 1);
256
+
281
257
  boolean isInlineImage = op.what instanceof TextInlineImageSpan;
282
258
  if (isInlineImage || op.what instanceof TextInlineViewPlaceholderSpan) {
283
259
  int height;
@@ -304,9 +280,8 @@ public abstract class ReactBaseTextShadowNode extends LayoutShadowNode {
304
280
  }
305
281
 
306
282
  // Actual order of calling {@code execute} does NOT matter,
307
- // but the {@code priority} DOES matter.
308
- op.execute(sb, priority);
309
- priority++;
283
+ // but the {@code priorityIndex} DOES matter.
284
+ op.execute(sb, priorityIndex);
310
285
  }
311
286
 
312
287
  textShadowNode.mTextAttributes.setHeightOfTallestInlineViewOrImage(
@@ -27,8 +27,6 @@ public class ReactTextUpdate {
27
27
  private final float mPaddingBottom;
28
28
  private final int mTextAlign;
29
29
  private final int mTextBreakStrategy;
30
- private final int mSelectionStart;
31
- private final int mSelectionEnd;
32
30
  private final int mJustificationMode;
33
31
 
34
32
  /**
@@ -55,35 +53,7 @@ public class ReactTextUpdate {
55
53
  paddingBottom,
56
54
  textAlign,
57
55
  Layout.BREAK_STRATEGY_HIGH_QUALITY,
58
- Layout.JUSTIFICATION_MODE_NONE,
59
- -1,
60
- -1);
61
- }
62
-
63
- public ReactTextUpdate(
64
- Spannable text,
65
- int jsEventCounter,
66
- boolean containsImages,
67
- float paddingStart,
68
- float paddingTop,
69
- float paddingEnd,
70
- float paddingBottom,
71
- int textAlign,
72
- int textBreakStrategy,
73
- int justificationMode) {
74
- this(
75
- text,
76
- jsEventCounter,
77
- containsImages,
78
- paddingStart,
79
- paddingTop,
80
- paddingEnd,
81
- paddingBottom,
82
- textAlign,
83
- textBreakStrategy,
84
- justificationMode,
85
- -1,
86
- -1);
56
+ Layout.JUSTIFICATION_MODE_NONE);
87
57
  }
88
58
 
89
59
  public ReactTextUpdate(
@@ -103,9 +73,7 @@ public class ReactTextUpdate {
103
73
  UNSET,
104
74
  textAlign,
105
75
  textBreakStrategy,
106
- justificationMode,
107
- -1,
108
- -1);
76
+ justificationMode);
109
77
  }
110
78
 
111
79
  public ReactTextUpdate(
@@ -118,9 +86,7 @@ public class ReactTextUpdate {
118
86
  float paddingBottom,
119
87
  int textAlign,
120
88
  int textBreakStrategy,
121
- int justificationMode,
122
- int selectionStart,
123
- int selectionEnd) {
89
+ int justificationMode) {
124
90
  mText = text;
125
91
  mJsEventCounter = jsEventCounter;
126
92
  mContainsImages = containsImages;
@@ -130,8 +96,6 @@ public class ReactTextUpdate {
130
96
  mPaddingBottom = paddingBottom;
131
97
  mTextAlign = textAlign;
132
98
  mTextBreakStrategy = textBreakStrategy;
133
- mSelectionStart = selectionStart;
134
- mSelectionEnd = selectionEnd;
135
99
  mJustificationMode = justificationMode;
136
100
  }
137
101
 
@@ -187,12 +151,4 @@ public class ReactTextUpdate {
187
151
  public int getJustificationMode() {
188
152
  return mJustificationMode;
189
153
  }
190
-
191
- public int getSelectionStart() {
192
- return mSelectionStart;
193
- }
194
-
195
- public int getSelectionEnd() {
196
- return mSelectionEnd;
197
- }
198
154
  }
@@ -0,0 +1,52 @@
1
+ package com.facebook.react.views.text;
2
+
3
+ import android.text.Spannable;
4
+ import android.text.SpannableStringBuilder;
5
+ import android.text.Spanned;
6
+ import com.facebook.common.logging.FLog;
7
+
8
+ class SetSpanOperation {
9
+ private static final String TAG = "SetSpanOperation";
10
+ static final int SPAN_MAX_PRIORITY = Spanned.SPAN_PRIORITY >> Spanned.SPAN_PRIORITY_SHIFT;
11
+
12
+ protected int start, end;
13
+ protected ReactSpan what;
14
+
15
+ SetSpanOperation(int start, int end, ReactSpan what) {
16
+ this.start = start;
17
+ this.end = end;
18
+ this.what = what;
19
+ }
20
+
21
+ /**
22
+ * @param sb builder
23
+ * @param priorityIndex index of this operation in the topological sorting which puts operations
24
+ * with higher priority before operations with lower priority.
25
+ */
26
+ public void execute(SpannableStringBuilder sb, int priorityIndex) {
27
+ assert priorityIndex >= 0;
28
+
29
+ // All spans will automatically extend to the right of the text, but not the left - except
30
+ // for spans that start at the beginning of the text.
31
+ int spanFlags = Spannable.SPAN_EXCLUSIVE_INCLUSIVE;
32
+ if (start == 0) {
33
+ spanFlags = Spannable.SPAN_INCLUSIVE_INCLUSIVE;
34
+ }
35
+
36
+ // Calculate priority, assigning the highest values to operations with the highest priority
37
+ final int priority = SPAN_MAX_PRIORITY - priorityIndex;
38
+
39
+ if (priority < 0) {
40
+ FLog.w(TAG, "Text tree size exceeded the limit, styling may become unpredictable");
41
+ }
42
+
43
+ // If the computed priority doesn't fit in the flags, clamp it. The effect might not be correct
44
+ // in 100% of cases, but doing nothing (as we did in the past) leads to totally random results.
45
+ final int effectivePriority = Math.max(priority, 0);
46
+
47
+ spanFlags &= ~Spannable.SPAN_PRIORITY;
48
+ spanFlags |= (effectivePriority << Spannable.SPAN_PRIORITY_SHIFT) & Spannable.SPAN_PRIORITY;
49
+
50
+ sb.setSpan(what, start, end, spanFlags);
51
+ }
52
+ }
@@ -213,12 +213,12 @@ public class TextLayoutManager {
213
213
 
214
214
  // TODO T31905686: add support for inline Images
215
215
  // While setting the Spans on the final text, we also check whether any of them are images.
216
- int priority = 0;
217
- for (SetSpanOperation op : ops) {
216
+ for (int priorityIndex = 0; priorityIndex < ops.size(); ++priorityIndex) {
217
+ final SetSpanOperation op = ops.get(ops.size() - priorityIndex - 1);
218
+
218
219
  // Actual order of calling {@code execute} does NOT matter,
219
- // but the {@code priority} DOES matter.
220
- op.execute(sb, priority);
221
- priority++;
220
+ // but the {@code priorityIndex} DOES matter.
221
+ op.execute(sb, priorityIndex);
222
222
  }
223
223
 
224
224
  if (reactTextViewManagerCallback != null) {
@@ -551,30 +551,4 @@ public class TextLayoutManager {
551
551
  hyphenationFrequency);
552
552
  return FontMetricsUtil.getFontMetrics(text, layout, sTextPaintInstance, context);
553
553
  }
554
-
555
- // TODO T31905686: This class should be private
556
- public static class SetSpanOperation {
557
- protected int start, end;
558
- protected ReactSpan what;
559
-
560
- public SetSpanOperation(int start, int end, ReactSpan what) {
561
- this.start = start;
562
- this.end = end;
563
- this.what = what;
564
- }
565
-
566
- public void execute(Spannable sb, int priority) {
567
- // All spans will automatically extend to the right of the text, but not the left - except
568
- // for spans that start at the beginning of the text.
569
- int spanFlags = Spannable.SPAN_EXCLUSIVE_INCLUSIVE;
570
- if (start == 0) {
571
- spanFlags = Spannable.SPAN_INCLUSIVE_INCLUSIVE;
572
- }
573
-
574
- spanFlags &= ~Spannable.SPAN_PRIORITY;
575
- spanFlags |= (priority << Spannable.SPAN_PRIORITY_SHIFT) & Spannable.SPAN_PRIORITY;
576
-
577
- sb.setSpan(what, start, end, spanFlags);
578
- }
579
- }
580
554
  }
@@ -227,12 +227,12 @@ public class TextLayoutManagerMapBuffer {
227
227
 
228
228
  // TODO T31905686: add support for inline Images
229
229
  // While setting the Spans on the final text, we also check whether any of them are images.
230
- int priority = 0;
231
- for (SetSpanOperation op : ops) {
230
+ for (int priorityIndex = 0; priorityIndex < ops.size(); ++priorityIndex) {
231
+ final SetSpanOperation op = ops.get(ops.size() - priorityIndex - 1);
232
+
232
233
  // Actual order of calling {@code execute} does NOT matter,
233
- // but the {@code priority} DOES matter.
234
- op.execute(sb, priority);
235
- priority++;
234
+ // but the {@code priorityIndex} DOES matter.
235
+ op.execute(sb, priorityIndex);
236
236
  }
237
237
 
238
238
  if (reactTextViewManagerCallback != null) {
@@ -570,30 +570,4 @@ public class TextLayoutManagerMapBuffer {
570
570
  hyphenationFrequency);
571
571
  return FontMetricsUtil.getFontMetrics(text, layout, sTextPaintInstance, context);
572
572
  }
573
-
574
- // TODO T31905686: This class should be private
575
- public static class SetSpanOperation {
576
- protected int start, end;
577
- protected ReactSpan what;
578
-
579
- public SetSpanOperation(int start, int end, ReactSpan what) {
580
- this.start = start;
581
- this.end = end;
582
- this.what = what;
583
- }
584
-
585
- public void execute(Spannable sb, int priority) {
586
- // All spans will automatically extend to the right of the text, but not the left - except
587
- // for spans that start at the beginning of the text.
588
- int spanFlags = Spannable.SPAN_EXCLUSIVE_INCLUSIVE;
589
- if (start == 0) {
590
- spanFlags = Spannable.SPAN_INCLUSIVE_INCLUSIVE;
591
- }
592
-
593
- spanFlags &= ~Spannable.SPAN_PRIORITY;
594
- spanFlags |= (priority << Spannable.SPAN_PRIORITY_SHIFT) & Spannable.SPAN_PRIORITY;
595
-
596
- sb.setSpan(what, start, end, spanFlags);
597
- }
598
- }
599
573
  }
@@ -116,6 +116,7 @@ public class ReactEditText extends AppCompatEditText
116
116
  private int mFontStyle = UNSET;
117
117
  private boolean mAutoFocus = false;
118
118
  private boolean mDidAttachToWindow = false;
119
+ private @Nullable String mPlaceholder = null;
119
120
 
120
121
  private ReactViewBackgroundManager mReactBackgroundManager;
121
122
 
@@ -496,6 +497,13 @@ public class ReactEditText extends AppCompatEditText
496
497
  setKeyListener(mKeyListener);
497
498
  }
498
499
 
500
+ public void setPlaceholder(@Nullable String placeholder) {
501
+ if (!Objects.equals(placeholder, mPlaceholder)) {
502
+ mPlaceholder = placeholder;
503
+ setHint(placeholder);
504
+ }
505
+ }
506
+
499
507
  public void setFontFamily(String fontFamily) {
500
508
  mFontFamily = fontFamily;
501
509
  mTypefaceDirty = true;
@@ -328,21 +328,19 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
328
328
 
329
329
  if (!args.isNull(1)) {
330
330
  String text = args.getString(1);
331
- reactEditText.maybeSetTextFromJS(
332
- getReactTextUpdate(text, mostRecentEventCount, start, end));
331
+ reactEditText.maybeSetTextFromJS(getReactTextUpdate(text, mostRecentEventCount));
333
332
  }
334
333
  reactEditText.maybeSetSelection(mostRecentEventCount, start, end);
335
334
  break;
336
335
  }
337
336
  }
338
337
 
339
- private ReactTextUpdate getReactTextUpdate(
340
- String text, int mostRecentEventCount, int start, int end) {
338
+ private ReactTextUpdate getReactTextUpdate(String text, int mostRecentEventCount) {
341
339
  SpannableStringBuilder sb = new SpannableStringBuilder();
342
340
  sb.append(TextTransform.apply(text, TextTransform.UNSET));
343
341
 
344
342
  return new ReactTextUpdate(
345
- sb, mostRecentEventCount, false, 0, 0, 0, 0, Gravity.NO_GRAVITY, 0, 0, start, end);
343
+ sb, mostRecentEventCount, false, 0, 0, 0, 0, Gravity.NO_GRAVITY, 0, 0);
346
344
  }
347
345
 
348
346
  @Override
@@ -373,9 +371,9 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
373
371
 
374
372
  // Ensure that selection is handled correctly on text update
375
373
  boolean isCurrentSelectionEmpty = view.getSelectionStart() == view.getSelectionEnd();
376
- int selectionStart = update.getSelectionStart();
377
- int selectionEnd = update.getSelectionEnd();
378
- if ((selectionStart == UNSET || selectionEnd == UNSET) && isCurrentSelectionEmpty) {
374
+ int selectionStart = UNSET;
375
+ int selectionEnd = UNSET;
376
+ if (isCurrentSelectionEmpty) {
379
377
  // if selection is not set by state, shift current selection to ensure constant gap to
380
378
  // text end
381
379
  int textLength = view.getText() == null ? 0 : view.getText().length();
@@ -507,7 +505,7 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
507
505
 
508
506
  @ReactProp(name = "placeholder")
509
507
  public void setPlaceholder(ReactEditText view, String placeholder) {
510
- view.setHint(placeholder);
508
+ view.setPlaceholder(placeholder);
511
509
  }
512
510
 
513
511
  @ReactProp(name = "placeholderTextColor", customType = "Color")
@@ -17,7 +17,6 @@ import androidx.annotation.Nullable;
17
17
  import androidx.core.view.ViewCompat;
18
18
  import com.facebook.common.logging.FLog;
19
19
  import com.facebook.infer.annotation.Assertions;
20
- import com.facebook.react.bridge.ReadableMap;
21
20
  import com.facebook.react.common.ReactConstants;
22
21
  import com.facebook.react.common.annotations.VisibleForTesting;
23
22
  import com.facebook.react.uimanager.Spacing;
@@ -44,13 +43,10 @@ public class ReactTextInputShadowNode extends ReactBaseTextShadowNode
44
43
 
45
44
  @VisibleForTesting public static final String PROP_TEXT = "text";
46
45
  @VisibleForTesting public static final String PROP_PLACEHOLDER = "placeholder";
47
- @VisibleForTesting public static final String PROP_SELECTION = "selection";
48
46
 
49
47
  // Represents the {@code text} property only, not possible nested content.
50
48
  private @Nullable String mText = null;
51
49
  private @Nullable String mPlaceholder = null;
52
- private int mSelectionStart = UNSET;
53
- private int mSelectionEnd = UNSET;
54
50
 
55
51
  public ReactTextInputShadowNode(
56
52
  @Nullable ReactTextViewManagerCallback reactTextViewManagerCallback) {
@@ -165,18 +161,6 @@ public class ReactTextInputShadowNode extends ReactBaseTextShadowNode
165
161
  @ReactProp(name = PROP_TEXT)
166
162
  public void setText(@Nullable String text) {
167
163
  mText = text;
168
- if (text != null) {
169
- // The selection shouldn't be bigger than the length of the text
170
- if (mSelectionStart > text.length()) {
171
- mSelectionStart = text.length();
172
- }
173
- if (mSelectionEnd > text.length()) {
174
- mSelectionEnd = text.length();
175
- }
176
- } else {
177
- mSelectionStart = UNSET;
178
- mSelectionEnd = UNSET;
179
- }
180
164
  markUpdated();
181
165
  }
182
166
 
@@ -194,18 +178,6 @@ public class ReactTextInputShadowNode extends ReactBaseTextShadowNode
194
178
  return mPlaceholder;
195
179
  }
196
180
 
197
- @ReactProp(name = PROP_SELECTION)
198
- public void setSelection(@Nullable ReadableMap selection) {
199
- mSelectionStart = mSelectionEnd = UNSET;
200
- if (selection == null) return;
201
-
202
- if (selection.hasKey("start") && selection.hasKey("end")) {
203
- mSelectionStart = selection.getInt("start");
204
- mSelectionEnd = selection.getInt("end");
205
- markUpdated();
206
- }
207
- }
208
-
209
181
  @Override
210
182
  public void setTextBreakStrategy(@Nullable String textBreakStrategy) {
211
183
  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
@@ -245,9 +217,7 @@ public class ReactTextInputShadowNode extends ReactBaseTextShadowNode
245
217
  getPadding(Spacing.BOTTOM),
246
218
  mTextAlign,
247
219
  mTextBreakStrategy,
248
- mJustificationMode,
249
- mSelectionStart,
250
- mSelectionEnd);
220
+ mJustificationMode);
251
221
  uiViewOperationQueue.enqueueUpdateExtraData(getReactTag(), reactTextUpdate);
252
222
  }
253
223
  }
@@ -567,19 +567,28 @@ public class ReactViewBackgroundDrawable extends Drawable {
567
567
  int colorRight = getBorderColor(Spacing.RIGHT);
568
568
  int colorBottom = getBorderColor(Spacing.BOTTOM);
569
569
  int borderColor = getBorderColor(Spacing.ALL);
570
+
570
571
  int colorBlock = getBorderColor(Spacing.BLOCK);
571
572
  int colorBlockStart = getBorderColor(Spacing.BLOCK_START);
572
573
  int colorBlockEnd = getBorderColor(Spacing.BLOCK_END);
573
574
 
575
+ if (isBorderColorDefined(Spacing.BLOCK)) {
576
+ colorBottom = colorBlock;
577
+ colorTop = colorBlock;
578
+ }
579
+ if (isBorderColorDefined(Spacing.BLOCK_END)) {
580
+ colorBottom = colorBlockEnd;
581
+ }
582
+ if (isBorderColorDefined(Spacing.BLOCK_START)) {
583
+ colorTop = colorBlockStart;
584
+ }
585
+
574
586
  // Clip border ONLY if its color is non transparent
575
587
  if (Color.alpha(colorLeft) != 0
576
588
  && Color.alpha(colorTop) != 0
577
589
  && Color.alpha(colorRight) != 0
578
590
  && Color.alpha(colorBottom) != 0
579
- && Color.alpha(borderColor) != 0
580
- && Color.alpha(colorBlock) != 0
581
- && Color.alpha(colorBlockStart) != 0
582
- && Color.alpha(colorBlockEnd) != 0) {
591
+ && Color.alpha(borderColor) != 0) {
583
592
 
584
593
  mInnerClipTempRectForBorderRadius.top += borderWidth.top;
585
594
  mInnerClipTempRectForBorderRadius.bottom -= borderWidth.bottom;
@@ -885,7 +894,7 @@ public class ReactViewBackgroundDrawable extends Drawable {
885
894
 
886
895
  /** Compute mInnerTopLeftCorner */
887
896
  mInnerTopLeftCorner.x = mInnerClipTempRectForBorderRadius.left;
888
- mInnerTopLeftCorner.y = mInnerClipTempRectForBorderRadius.top * 2;
897
+ mInnerTopLeftCorner.y = mInnerClipTempRectForBorderRadius.top;
889
898
 
890
899
  getEllipseIntersectionWithLine(
891
900
  // Ellipse Bounds
@@ -911,10 +920,7 @@ public class ReactViewBackgroundDrawable extends Drawable {
911
920
  }
912
921
 
913
922
  mInnerBottomLeftCorner.x = mInnerClipTempRectForBorderRadius.left;
914
- mInnerBottomLeftCorner.y =
915
- borderWidth.bottom != 0
916
- ? mInnerClipTempRectForBorderRadius.bottom * -2
917
- : mInnerClipTempRectForBorderRadius.bottom;
923
+ mInnerBottomLeftCorner.y = mInnerClipTempRectForBorderRadius.bottom;
918
924
 
919
925
  getEllipseIntersectionWithLine(
920
926
  // Ellipse Bounds
@@ -940,7 +946,7 @@ public class ReactViewBackgroundDrawable extends Drawable {
940
946
  }
941
947
 
942
948
  mInnerTopRightCorner.x = mInnerClipTempRectForBorderRadius.right;
943
- mInnerTopRightCorner.y = mInnerClipTempRectForBorderRadius.top * 2;
949
+ mInnerTopRightCorner.y = mInnerClipTempRectForBorderRadius.top;
944
950
 
945
951
  getEllipseIntersectionWithLine(
946
952
  // Ellipse Bounds
@@ -966,10 +972,7 @@ public class ReactViewBackgroundDrawable extends Drawable {
966
972
  }
967
973
 
968
974
  mInnerBottomRightCorner.x = mInnerClipTempRectForBorderRadius.right;
969
- mInnerBottomRightCorner.y =
970
- borderWidth.bottom != 0
971
- ? mInnerClipTempRectForBorderRadius.bottom * -2
972
- : mInnerClipTempRectForBorderRadius.bottom;
975
+ mInnerBottomRightCorner.y = mInnerClipTempRectForBorderRadius.bottom;
973
976
 
974
977
  getEllipseIntersectionWithLine(
975
978
  // Ellipse Bounds
@@ -18,7 +18,7 @@ constexpr struct {
18
18
  int32_t Major = 0;
19
19
  int32_t Minor = 72;
20
20
  int32_t Patch = 0;
21
- std::string_view Prerelease = "rc.5";
21
+ std::string_view Prerelease = "rc.6";
22
22
  } ReactNativeVersion;
23
23
 
24
24
  } // namespace facebook::react
@@ -134,8 +134,6 @@ AndroidTextInputProps::AndroidTextInputProps(
134
134
  "selectionColor",
135
135
  sourceProps.selectionColor,
136
136
  {})),
137
- selection(CoreFeatures::enablePropIteratorSetter? sourceProps.selection :
138
- convertRawProp(context, rawProps, "selection", sourceProps.selection, {})),
139
137
  value(CoreFeatures::enablePropIteratorSetter? sourceProps.value : convertRawProp(context, rawProps, "value", sourceProps.value, {})),
140
138
  defaultValue(CoreFeatures::enablePropIteratorSetter? sourceProps.defaultValue : convertRawProp(context, rawProps,
141
139
  "defaultValue",
@@ -349,7 +347,6 @@ void AndroidTextInputProps::setProp(
349
347
  RAW_SET_PROP_SWITCH_CASE_BASIC(placeholderTextColor);
350
348
  RAW_SET_PROP_SWITCH_CASE_BASIC(secureTextEntry);
351
349
  RAW_SET_PROP_SWITCH_CASE_BASIC(selectionColor);
352
- RAW_SET_PROP_SWITCH_CASE_BASIC(selection);
353
350
  RAW_SET_PROP_SWITCH_CASE_BASIC(defaultValue);
354
351
  RAW_SET_PROP_SWITCH_CASE_BASIC(selectTextOnFocus);
355
352
  RAW_SET_PROP_SWITCH_CASE_BASIC(submitBehavior);
@@ -449,7 +446,6 @@ folly::dynamic AndroidTextInputProps::getDynamic() const {
449
446
  props["placeholderTextColor"] = toAndroidRepr(placeholderTextColor);
450
447
  props["secureTextEntry"] = secureTextEntry;
451
448
  props["selectionColor"] = toAndroidRepr(selectionColor);
452
- props["selection"] = toDynamic(selection);
453
449
  props["value"] = value;
454
450
  props["defaultValue"] = defaultValue;
455
451
  props["selectTextOnFocus"] = selectTextOnFocus;
@@ -27,32 +27,6 @@
27
27
  namespace facebook {
28
28
  namespace react {
29
29
 
30
- struct AndroidTextInputSelectionStruct {
31
- int start;
32
- int end;
33
- };
34
-
35
- static inline void fromRawValue(
36
- const PropsParserContext &context,
37
- const RawValue &value,
38
- AndroidTextInputSelectionStruct &result) {
39
- auto map = (butter::map<std::string, RawValue>)value;
40
-
41
- auto start = map.find("start");
42
- if (start != map.end()) {
43
- fromRawValue(context, start->second, result.start);
44
- }
45
- auto end = map.find("end");
46
- if (end != map.end()) {
47
- fromRawValue(context, end->second, result.end);
48
- }
49
- }
50
-
51
- static inline std::string toString(
52
- const AndroidTextInputSelectionStruct &value) {
53
- return "[Object AndroidTextInputSelectionStruct]";
54
- }
55
-
56
30
  struct AndroidTextInputTextShadowOffsetStruct {
57
31
  double width;
58
32
  double height;
@@ -87,13 +61,6 @@ inline folly::dynamic toDynamic(
87
61
  dynamicValue["height"] = value.height;
88
62
  return dynamicValue;
89
63
  }
90
-
91
- inline folly::dynamic toDynamic(const AndroidTextInputSelectionStruct &value) {
92
- folly::dynamic dynamicValue = folly::dynamic::object();
93
- dynamicValue["start"] = value.start;
94
- dynamicValue["end"] = value.end;
95
- return dynamicValue;
96
- }
97
64
  #endif
98
65
 
99
66
  class AndroidTextInputProps final : public ViewProps, public BaseTextProps {
@@ -138,7 +105,6 @@ class AndroidTextInputProps final : public ViewProps, public BaseTextProps {
138
105
  SharedColor placeholderTextColor{};
139
106
  bool secureTextEntry{false};
140
107
  SharedColor selectionColor{};
141
- AndroidTextInputSelectionStruct selection{};
142
108
  std::string value{};
143
109
  std::string defaultValue{};
144
110
  bool selectTextOnFocus{false};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native",
3
- "version": "0.72.0-rc.5",
3
+ "version": "0.72.0-rc.6",
4
4
  "bin": "./cli.js",
5
5
  "description": "A framework for building native apps using React",
6
6
  "license": "MIT",
@@ -79,11 +79,11 @@
79
79
  },
80
80
  "dependencies": {
81
81
  "@jest/create-cache-key-function": "^29.2.1",
82
- "@react-native-community/cli": "11.3.1",
83
- "@react-native-community/cli-platform-android": "11.3.1",
84
- "@react-native-community/cli-platform-ios": "11.3.1",
82
+ "@react-native-community/cli": "11.3.2",
83
+ "@react-native-community/cli-platform-android": "11.3.2",
84
+ "@react-native-community/cli-platform-ios": "11.3.2",
85
85
  "@react-native/assets-registry": "^0.72.0",
86
- "@react-native/codegen": "^0.72.5",
86
+ "@react-native/codegen": "^0.72.6",
87
87
  "@react-native/gradle-plugin": "^0.72.10",
88
88
  "@react-native/js-polyfills": "^0.72.1",
89
89
  "@react-native/normalize-colors": "^0.72.0",
@@ -434,6 +434,60 @@ class UtilsTests < Test::Unit::TestCase
434
434
  assert_equal(user_project_mock.save_invocation_count, 1)
435
435
  end
436
436
 
437
+ # ================================= #
438
+ # Test - Apply Xcode 15 Patch #
439
+ # ================================= #
440
+
441
+ def test_applyXcode15Patch_correctlyAppliesNecessaryPatch
442
+ # Arrange
443
+ first_target = prepare_target("FirstTarget")
444
+ second_target = prepare_target("SecondTarget")
445
+ third_target = TargetMock.new("ThirdTarget", [
446
+ BuildConfigurationMock.new("Debug", {
447
+ "GCC_PREPROCESSOR_DEFINITIONS" => '$(inherited) "SomeFlag=1" '
448
+ }),
449
+ BuildConfigurationMock.new("Release", {
450
+ "GCC_PREPROCESSOR_DEFINITIONS" => '$(inherited) "SomeFlag=1" '
451
+ }),
452
+ ], nil)
453
+
454
+ user_project_mock = UserProjectMock.new("a/path", [
455
+ prepare_config("Debug"),
456
+ prepare_config("Release"),
457
+ ],
458
+ :native_targets => [
459
+ first_target,
460
+ second_target
461
+ ]
462
+ )
463
+ pods_projects_mock = PodsProjectMock.new([], {"hermes-engine" => {}}, :native_targets => [
464
+ third_target
465
+ ])
466
+ installer = InstallerMock.new(pods_projects_mock, [
467
+ AggregatedProjectMock.new(user_project_mock)
468
+ ])
469
+
470
+ # Act
471
+ ReactNativePodsUtils.apply_xcode_15_patch(installer)
472
+
473
+ # Assert
474
+ first_target.build_configurations.each do |config|
475
+ assert_equal(config.build_settings["GCC_PREPROCESSOR_DEFINITIONS"].strip,
476
+ '$(inherited) "_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION"'
477
+ )
478
+ end
479
+ second_target.build_configurations.each do |config|
480
+ assert_equal(config.build_settings["GCC_PREPROCESSOR_DEFINITIONS"].strip,
481
+ '$(inherited) "_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION"'
482
+ )
483
+ end
484
+ third_target.build_configurations.each do |config|
485
+ assert_equal(config.build_settings["GCC_PREPROCESSOR_DEFINITIONS"].strip,
486
+ '$(inherited) "SomeFlag=1" "_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION"'
487
+ )
488
+ end
489
+ end
490
+
437
491
  # ==================================== #
438
492
  # Test - Set Node_Modules User Setting #
439
493
  # ==================================== #
@@ -121,6 +121,18 @@ class ReactNativePodsUtils
121
121
  end
122
122
  end
123
123
 
124
+ def self.apply_xcode_15_patch(installer)
125
+ installer.target_installation_results.pod_target_installation_results
126
+ .each do |pod_name, target_installation_result|
127
+ target_installation_result.native_target.build_configurations.each do |config|
128
+ # unary_function and binary_function are no longer provided in C++17 and newer standard modes as part of Xcode 15. They can be re-enabled with setting _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION
129
+ # Ref: https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#Deprecations
130
+ config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= '$(inherited) '
131
+ config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << '"_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION" '
132
+ end
133
+ end
134
+ end
135
+
124
136
  def self.apply_flags_for_fabric(installer, fabric_enabled: false)
125
137
  fabric_flag = "-DRN_FABRIC_ENABLED"
126
138
  if fabric_enabled
@@ -244,6 +244,7 @@ def react_native_post_install(
244
244
  ReactNativePodsUtils.update_search_paths(installer)
245
245
  ReactNativePodsUtils.set_node_modules_user_settings(installer, react_native_path)
246
246
  ReactNativePodsUtils.apply_flags_for_fabric(installer, fabric_enabled: fabric_enabled)
247
+ ReactNativePodsUtils.apply_xcode_15_patch(installer)
247
248
 
248
249
  NewArchitectureHelper.set_clang_cxx_language_standard_if_needed(installer)
249
250
  is_new_arch_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == "1"
Binary file
Binary file
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "react": "18.2.0",
14
- "react-native": "0.72.0-rc.5"
14
+ "react-native": "0.72.0-rc.6"
15
15
  },
16
16
  "devDependencies": {
17
17
  "@babel/core": "^7.20.0",