Skip to content

Commit 7d147de

Browse files
committed
passing textAlignVert from js NestedText to Java
1 parent 6716e0f commit 7d147de

File tree

9 files changed

+28
-28
lines changed

9 files changed

+28
-28
lines changed

ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public class TextAttributeProps {
5454
public static final short TA_KEY_IS_HIGHLIGHTED = 20;
5555
public static final short TA_KEY_LAYOUT_DIRECTION = 21;
5656
public static final short TA_KEY_ACCESSIBILITY_ROLE = 22;
57-
public static final short TA_KEY_VERTICAL_ALIGN = 23;
57+
public static final short TA_KEY_ALIGN_VERTICAL = 24;
5858

5959
public static final int UNSET = -1;
6060

@@ -208,8 +208,8 @@ public static TextAttributeProps fromMapBuffer(MapBuffer props) {
208208
case TA_KEY_ACCESSIBILITY_ROLE:
209209
result.setAccessibilityRole(entry.getStringValue());
210210
break;
211-
case TA_KEY_VERTICAL_ALIGN:
212-
result.setVerticalAlign(entry.getStringValue());
211+
case TA_KEY_ALIGN_VERTICAL:
212+
result.setTextAlignVertical(entry.getStringValue());
213213
break;
214214
}
215215
}
@@ -615,9 +615,9 @@ private void setAccessibilityRole(@Nullable String accessibilityRole) {
615615
}
616616
}
617617

618-
private void setVerticalAlign(@Nullable String verticalAlign) {
619-
FLog.w("React::", "verticalAlign: " + (verticalAlign));
618+
private void setTextAlignVertical(@Nullable String verticalAlign) {
620619
if (verticalAlign != null) {
620+
FLog.w("React::", "verticalAlign: " + (verticalAlign));
621621
mVerticalAlign = verticalAlign;
622622
}
623623
}

ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManagerMapBuffer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ private static void buildSpannableFromFragment(
144144
ops.add(new SetSpanOperation(start, end, new ReactSuperscriptSpan()));
145145
}
146146
if (textAttributes.mIsAccessibilityLink) {
147-
ops.add(new SetSpanOperation(start, end, new ReactClickableSpan(reactTag)));
147+
ops.add(new SetSpanOperation(start, end, new ReactSuperscriptSpan()));
148148
}
149149
if (textAttributes.mIsColorSet) {
150150
ops.add(

ReactCommon/react/renderer/attributedstring/TextAttributes.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ void TextAttributes::apply(TextAttributes textAttributes) {
101101
accessibilityRole = textAttributes.accessibilityRole.has_value()
102102
? textAttributes.accessibilityRole
103103
: accessibilityRole;
104-
textVerticalAlign = !textAttributes.textVerticalAlign.empty() ? textAttributes.textVerticalAlign : textVerticalAlign;
104+
textAlignVertical = !textAttributes.textAlignVertical.empty() ? textAttributes.textAlignVertical : textAlignVertical;
105105
}
106106

107107
#pragma mark - Operators
@@ -127,7 +127,7 @@ bool TextAttributes::operator==(const TextAttributes &rhs) const {
127127
isHighlighted,
128128
layoutDirection,
129129
accessibilityRole,
130-
textVerticalAlign,
130+
textAlignVertical,
131131
textTransform) ==
132132
std::tie(
133133
rhs.foregroundColor,
@@ -149,7 +149,7 @@ bool TextAttributes::operator==(const TextAttributes &rhs) const {
149149
rhs.isHighlighted,
150150
rhs.layoutDirection,
151151
rhs.accessibilityRole,
152-
rhs.textVerticalAlign,
152+
rhs.textAlignVertical,
153153
rhs.textTransform) &&
154154
floatEquality(opacity, rhs.opacity) &&
155155
floatEquality(fontSize, rhs.fontSize) &&
@@ -218,7 +218,7 @@ SharedDebugStringConvertibleList TextAttributes::getDebugProps() const {
218218
debugStringConvertibleItem("isHighlighted", isHighlighted),
219219
debugStringConvertibleItem("layoutDirection", layoutDirection),
220220
debugStringConvertibleItem("accessibilityRole", accessibilityRole),
221-
debugStringConvertibleItem("textVerticalAlign", textVerticalAlign),
221+
debugStringConvertibleItem("textAlignVertical", textAlignVertical),
222222
};
223223
}
224224
#endif

ReactCommon/react/renderer/attributedstring/TextAttributes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class TextAttributes : public DebugStringConvertible {
8181
// construction.
8282
std::optional<LayoutDirection> layoutDirection{};
8383
std::optional<AccessibilityRole> accessibilityRole{};
84-
std::string textVerticalAlign{""};
84+
std::string textAlignVertical{};
8585

8686
#pragma mark - Operations
8787

ReactCommon/react/renderer/attributedstring/conversions.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,9 +1036,9 @@ inline folly::dynamic toDynamic(const TextAttributes &textAttributes) {
10361036
_textAttributes(
10371037
"accessibilityRole", toString(*textAttributes.accessibilityRole));
10381038
}
1039-
if (!textAttributes.textVerticalAlign.empty()) {
1039+
if (!textAttributes.textAlignVertical.empty()) {
10401040
_textAttributes(
1041-
"textVerticalAlign", textAttributes.textVerticalAlign);
1041+
"textAlignVertical", textAttributes.textAlignVertical);
10421042
}
10431043
return _textAttributes;
10441044
}
@@ -1261,9 +1261,9 @@ inline MapBuffer toMapBuffer(const TextAttributes &textAttributes) {
12611261
builder.putString(
12621262
TA_KEY_ACCESSIBILITY_ROLE, toString(*textAttributes.accessibilityRole));
12631263
}
1264-
if (textAttributes.textVerticalAlign.empty()) {
1264+
if (!textAttributes.textAlignVertical.empty()) {
12651265
builder.putString(
1266-
TA_KEY_VERTICAL_ALIGN, textAttributes.textVerticalAlign);
1266+
TA_KEY_VERTICAL_ALIGN, textAttributes.textAlignVertical);
12671267
}
12681268
return builder.build();
12691269
}

ReactCommon/react/renderer/components/text/BaseTextProps.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,12 @@ static TextAttributes convertRawProp(
197197
sourceTextAttributes.backgroundColor,
198198
defaultTextAttributes.backgroundColor);
199199

200-
textAttributes.textVerticalAlign = convertRawProp(
200+
textAttributes.textAlignVertical = convertRawProp(
201201
context,
202202
rawProps,
203-
"textVerticalAlign",
204-
sourceTextAttributes.textVerticalAlign,
205-
defaultTextAttributes.textVerticalAlign);
203+
"textAlignVertical",
204+
sourceTextAttributes.textAlignVertical,
205+
defaultTextAttributes.textAlignVertical);
206206

207207
return textAttributes;
208208
}
@@ -305,7 +305,7 @@ void BaseTextProps::setProp(
305305
REBUILD_FIELD_SWITCH_CASE(
306306
defaults, value, textAttributes, backgroundColor, "backgroundColor");
307307
REBUILD_FIELD_SWITCH_CASE(
308-
defaults, value, textAttributes, backgroundColor, "textVerticalAlign");
308+
defaults, value, textAttributes, backgroundColor, "textAlignVertical");
309309
}
310310
}
311311

ReactCommon/react/renderer/components/view/ViewProps.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@ ViewProps::ViewProps(
5151
"backgroundColor",
5252
sourceProps.backgroundColor,
5353
{})),
54-
textVerticalAlign(
54+
textAlignVertical(
5555
CoreFeatures::enablePropIteratorSetter
56-
? sourceProps.textVerticalAlign
56+
? sourceProps.textAlignVertical
5757
: convertRawProp(
5858
context,
5959
rawProps,
60-
"textVerticalAlign",
61-
sourceProps.textVerticalAlign,
60+
"textAlignVertical",
61+
sourceProps.textAlignVertical,
6262
{})),
6363
borderRadii(
6464
CoreFeatures::enablePropIteratorSetter ? sourceProps.borderRadii
@@ -302,7 +302,7 @@ void ViewProps::setProp(
302302
RAW_SET_PROP_SWITCH_CASE_BASIC(opacity, (Float)1.0);
303303
RAW_SET_PROP_SWITCH_CASE_BASIC(foregroundColor, {});
304304
RAW_SET_PROP_SWITCH_CASE_BASIC(backgroundColor, {});
305-
RAW_SET_PROP_SWITCH_CASE_BASIC(textVerticalAlign, {});
305+
RAW_SET_PROP_SWITCH_CASE_BASIC(textAlignVertical, {});
306306
RAW_SET_PROP_SWITCH_CASE_BASIC(shadowColor, {});
307307
RAW_SET_PROP_SWITCH_CASE_BASIC(shadowOffset, {});
308308
RAW_SET_PROP_SWITCH_CASE_BASIC(shadowOpacity, {});

ReactCommon/react/renderer/components/view/ViewProps.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class ViewProps : public YogaStylableProps, public AccessibilityProps {
5151
Float opacity{1.0};
5252
SharedColor foregroundColor{};
5353
SharedColor backgroundColor{};
54-
std::string textVerticalAlign{""};
54+
std::string textAlignVertical{""};
5555

5656
// Borders
5757
CascadedBorderRadii borderRadii{};

ReactCommon/react/renderer/components/view/ViewPropsMapBuffer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ void ViewProps::propsDiffMapBuffer(
6060
builder.putInt(VP_FG_COLOR, toAndroidRepr(newProps.foregroundColor));
6161
}
6262

63-
if (oldProps.textVerticalAlign != newProps.textVerticalAlign) {
64-
builder.putString(VP_TEXT_VERTICAL_ALIGN, newProps.textVerticalAlign);
63+
if (oldProps.textAlignVertical != newProps.textAlignVertical) {
64+
builder.putString(VP_TEXT_VERTICAL_ALIGN, newProps.textAlignVertical);
6565
}
6666

6767
if (oldProps.borderCurves != newProps.borderCurves) {

0 commit comments

Comments
 (0)