Skip to content

Commit 676ed17

Browse files
committed
fix(android,ios): rebase onto CanvasEffectSpan rename + iOS Wavy stub
Three CI breakages were introduced by changes that landed on `main` between the original PR push and now: 1. PR #56705 renamed `DrawCommandSpan` to `CanvasEffectSpan` and dropped the `ReactSpan` / `UpdateAppearance` interfaces from the base class. `ReactUnderlineSpan` and `ReactStrikethroughSpan` were extending the old name; rename them and re-declare `ReactSpan` so they remain valid `SetSpanOperation` arguments. `ReactTextView.onDraw` updated to import the new name. 2. Adding `Wavy` to `facebook::react::TextDecorationStyle` (this PR) left `RCTNSUnderlineStyleFromTextDecorationStyle` non-exhaustive, tripping `-Werror,-Wreturn-type` on iOS builds. Add a `Wavy` case that falls back to a solid underline (the actual wavy rendering ships in companion PR #56769). 3. `validate_cxx_api_snapshots` flagged the missing `Wavy` entry in all six snapshots under `scripts/cxx-api/api-snapshots/`. Regenerate. No behavior change beyond what was already in the feature commit; this is purely "rebase the implementation onto current `main`."
1 parent 9d4f0af commit 676ed17

10 files changed

Lines changed: 14 additions & 6 deletions

File tree

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
import com.facebook.react.uimanager.style.BorderStyle;
4747
import com.facebook.react.uimanager.style.LogicalEdge;
4848
import com.facebook.react.uimanager.style.Overflow;
49-
import com.facebook.react.views.text.internal.span.DrawCommandSpan;
49+
import com.facebook.react.views.text.internal.span.CanvasEffectSpan;
5050
import com.facebook.react.views.text.internal.span.ReactFragmentIndexSpan;
5151
import com.facebook.react.views.text.internal.span.ReactTagSpan;
5252
import com.facebook.yoga.YogaMeasureMode;
@@ -218,12 +218,12 @@ protected void onDraw(Canvas canvas) {
218218
if (spanned != null) {
219219
Layout layout = getLayout();
220220
if (layout != null) {
221-
DrawCommandSpan[] drawSpans =
222-
spanned.getSpans(0, spanned.length(), DrawCommandSpan.class);
221+
CanvasEffectSpan[] drawSpans =
222+
spanned.getSpans(0, spanned.length(), CanvasEffectSpan.class);
223223
if (drawSpans.length > 0) {
224224
canvas.save();
225225
canvas.translate(getCompoundPaddingLeft(), getExtendedPaddingTop());
226-
for (DrawCommandSpan span : drawSpans) {
226+
for (CanvasEffectSpan span : drawSpans) {
227227
int start = spanned.getSpanStart(span);
228228
int end = spanned.getSpanEnd(span);
229229
span.onDraw(start, end, canvas, layout);

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ReactStrikethroughSpan.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import com.facebook.react.views.text.drawSpannedDecoration
2626
internal class ReactStrikethroughSpan(
2727
private val color: Int = Color.TRANSPARENT,
2828
private val style: TextDecorationStyle = TextDecorationStyle.SOLID,
29-
) : DrawCommandSpan() {
29+
) : CanvasEffectSpan(), ReactSpan {
3030

3131
override fun onDraw(start: Int, end: Int, canvas: Canvas, layout: Layout) {
3232
drawSpannedDecoration(start, end, canvas, layout, color, style) { paint, baseline, _ ->

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ReactUnderlineSpan.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import com.facebook.react.views.text.drawSpannedDecoration
2727
internal class ReactUnderlineSpan(
2828
private val color: Int = Color.TRANSPARENT,
2929
private val style: TextDecorationStyle = TextDecorationStyle.SOLID,
30-
) : DrawCommandSpan() {
30+
) : CanvasEffectSpan(), ReactSpan {
3131

3232
override fun onDraw(start: Int, end: Int, canvas: Canvas, layout: Layout) {
3333
drawSpannedDecoration(start, end, canvas, layout, color, style) { _, baseline, thickness ->

packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextPrimitivesConversions.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ inline static NSUnderlineStyle RCTNSUnderlineStyleFromTextDecorationStyle(
110110
return NSUnderlineStylePatternDash | NSUnderlineStyleSingle;
111111
case facebook::react::TextDecorationStyle::Dotted:
112112
return NSUnderlineStylePatternDot | NSUnderlineStyleSingle;
113+
case facebook::react::TextDecorationStyle::Wavy:
114+
return NSUnderlineStyleSingle;
113115
}
114116
}
115117

scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6505,6 +6505,7 @@ enum facebook::react::TextDecorationStyle {
65056505
Dotted,
65066506
Double,
65076507
Solid,
6508+
Wavy,
65086509
}
65096510

65106511
enum facebook::react::TextTransform {

scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6496,6 +6496,7 @@ enum facebook::react::TextDecorationStyle {
64966496
Dotted,
64976497
Double,
64986498
Solid,
6499+
Wavy,
64996500
}
65006501

65016502
enum facebook::react::TextTransform {

scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9073,6 +9073,7 @@ enum facebook::react::TextDecorationStyle {
90739073
Dotted,
90749074
Double,
90759075
Solid,
9076+
Wavy,
90769077
}
90779078

90789079
enum facebook::react::TextInputAccessoryVisibilityMode {

scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9064,6 +9064,7 @@ enum facebook::react::TextDecorationStyle {
90649064
Dotted,
90659065
Double,
90669066
Solid,
9067+
Wavy,
90679068
}
90689069

90699070
enum facebook::react::TextInputAccessoryVisibilityMode {

scripts/cxx-api/api-snapshots/ReactCommonDebugCxx.api

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4856,6 +4856,7 @@ enum facebook::react::TextDecorationStyle {
48564856
Dotted,
48574857
Double,
48584858
Solid,
4859+
Wavy,
48594860
}
48604861

48614862
enum facebook::react::TextTransform {

scripts/cxx-api/api-snapshots/ReactCommonReleaseCxx.api

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4847,6 +4847,7 @@ enum facebook::react::TextDecorationStyle {
48474847
Dotted,
48484848
Double,
48494849
Solid,
4850+
Wavy,
48504851
}
48514852

48524853
enum facebook::react::TextTransform {

0 commit comments

Comments
 (0)