Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android TextInput: Improve application of styles for value prop #22461

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,16 @@ public void execute(SpannableStringBuilder sb, int priority) {
private static void buildSpannedFromShadowNode(
ReactBaseTextShadowNode textShadowNode,
SpannableStringBuilder sb,
List<SetSpanOperation> ops) {

int start = sb.length();
List<SetSpanOperation> ops,
int start) {

for (int i = 0, length = textShadowNode.getChildCount(); i < length; i++) {
ReactShadowNode child = textShadowNode.getChildAt(i);

if (child instanceof ReactRawTextShadowNode) {
sb.append(((ReactRawTextShadowNode) child).getText());
} else if (child instanceof ReactBaseTextShadowNode) {
buildSpannedFromShadowNode((ReactBaseTextShadowNode) child, sb, ops);
buildSpannedFromShadowNode((ReactBaseTextShadowNode) child, sb, ops, sb.length());
} else if (child instanceof ReactTextInlineImageShadowNode) {
// We make the image take up 1 character in the span and put a corresponding character into
// the text so that the image doesn't run over any following text.
Expand Down Expand Up @@ -201,12 +200,14 @@ protected static Spannable spannedFromShadowNode(
// a new spannable will be wiped out
List<SetSpanOperation> ops = new ArrayList<>();

buildSpannedFromShadowNode(textShadowNode, sb, ops);

if (text != null) {
// Handle text that is provided via a prop (e.g. the `value` and `defaultValue` props on
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this, took me a while to figure out what this was for when working on fixing textTransform.

// TextInput).
sb.append(text);
}

buildSpannedFromShadowNode(textShadowNode, sb, ops, 0);

if (textShadowNode.mFontSize == UNSET) {
int defaultFontSize = textShadowNode.getDefaultFontSize();

Expand Down