Skip to content

Conversation

@fluiddot
Copy link
Contributor

@fluiddot fluiddot commented Jul 17, 2023

Removes an unneeded workaround on Android related to correcting the font-weight style when using numerical values. This is no longer needed as a fix was introduced in React Native 0.65 (reference - Fix font weight numeric values).

As a side note, I debugged the workaround and noticed that it wasn't actually being applied 😅. The style prop is being fetched from the wrong object, as the following code is always returning undefined:

const { style } = baseText.props;

As an example, here the props of baseText for an element that has the font-weight style attribute set:

{"children": <RCTText accessible={true} allowFontScaling={true} ellipsizeMode="tail" isHighlighted={false} selectionColor={null} style={{"color": "#2e4453", "fontSize": 14, "fontWeight": "600", "marginTop": 4, "textAlign": "center"}}>Table</RCTText>, "value": true}

The styles should be fetched from the children element not baseText. I updated the code to enable the workaround but still the original font-weight issue is no longer happening.

To test:
Following the test cases from the PR that introduced the workaround:

  • Open a post that contains an unsupported block (e.g. Table block).
  • Observe that the block's title text is rendered with proper font-weight.

PR submission checklist:

  • I have considered adding unit tests where possible.
  • I have considered if this change warrants user-facing release notes more info and have added them to RELEASE-NOTES.txt if necessary.

@fluiddot fluiddot added this to the 1.100.0 (22.9) milestone Jul 17, 2023
@fluiddot fluiddot self-assigned this Jul 17, 2023
@fluiddot fluiddot mentioned this pull request Jul 17, 2023
4 tasks
@geriux geriux self-requested a review July 17, 2023 11:43
Copy link
Contributor

@geriux geriux left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for fixing this issue 👏

So nice to remove an old workaround that wasn't even being used 😅 🚀

@fluiddot fluiddot merged commit 6c3964a into trunk Jul 17, 2023
@fluiddot fluiddot deleted the fix/remove-text-font-weight-correction branch July 17, 2023 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants