Skip to content

Commit

Permalink
fix: textTransform not working in new arch (#41223)
Browse files Browse the repository at this point in the history
Summary:
Fixes: #39524

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:
For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[ANDROID] [FIXED] - Fix textTransform not working in new architecture

Pull Request resolved: #41223

Test Plan:
**Before:**
<img width="307" alt="image" src="https://github.com/facebook/react-native/assets/34857453/d44e6030-0a49-42c9-be44-cf7541583af0">

**After:**
<img width="307" alt="image" src="https://github.com/facebook/react-native/assets/34857453/fb717cec-72d3-41d7-8c48-4ec9a9ecb16b">

Reviewed By: javache

Differential Revision: D50773216

Pulled By: NickGerleman

fbshipit-source-id: 769bf67f2661ff4ff7b88121493bdd27564458d3
  • Loading branch information
tarunrajput authored and facebook-github-bot committed Oct 31, 2023
1 parent a4edaf2 commit a2f3fa6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Expand Up @@ -59,6 +59,7 @@ public class TextAttributeProps {
public static final short TA_KEY_ACCESSIBILITY_ROLE = 24;
public static final short TA_KEY_LINE_BREAK_STRATEGY = 25;
public static final short TA_KEY_ROLE = 26;
public static final short TA_KEY_TEXT_TRANSFORM = 27;

public static final int UNSET = -1;

Expand Down Expand Up @@ -217,14 +218,16 @@ public static TextAttributeProps fromMapBuffer(MapBuffer props) {
case TA_KEY_ROLE:
result.setRole(Role.values()[entry.getIntValue()]);
break;
case TA_KEY_TEXT_TRANSFORM:
result.setTextTransform(entry.getStringValue());
break;
}
}

// TODO T83483191: Review why the following props are not serialized:
// setNumberOfLines
// setColor
// setIncludeFontPadding
// setTextTransform
return result;
}

Expand Down
Expand Up @@ -970,6 +970,7 @@ constexpr static MapBuffer::Key TA_KEY_LAYOUT_DIRECTION = 23;
constexpr static MapBuffer::Key TA_KEY_ACCESSIBILITY_ROLE = 24;
constexpr static MapBuffer::Key TA_KEY_LINE_BREAK_STRATEGY = 25;
constexpr static MapBuffer::Key TA_KEY_ROLE = 26;
constexpr static MapBuffer::Key TA_KEY_TEXT_TRANSFORM = 27;

// constants for ParagraphAttributes serialization
constexpr static MapBuffer::Key PA_KEY_MAX_NUMBER_OF_LINES = 0;
Expand Down Expand Up @@ -1077,6 +1078,11 @@ inline MapBuffer toMapBuffer(const TextAttributes& textAttributes) {
TA_KEY_LINE_BREAK_STRATEGY,
toString(*textAttributes.lineBreakStrategy));
}
if (textAttributes.textTransform.has_value()) {
builder.putString(
TA_KEY_TEXT_TRANSFORM, toString(*textAttributes.textTransform));
}

// Decoration
if (textAttributes.textDecorationColor) {
builder.putInt(
Expand Down

0 comments on commit a2f3fa6

Please sign in to comment.