Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: apply font size to ReactTextView to fix ellipsis cut (#37248)
Summary: This PR aims to fix #36350. In certain cases, when the text is cut due to `numberOfLines`, the ellipsis appear cut. This is actually an Android bug, which was reported on their side [here](https://issuetracker.google.com/issues/278044456). This PR contains a workaround for it by applying the text size to the TextView directly instead of just the Spannable inside it. This solves all problems and it seems like it does not cause any regressions. ## Changelog: <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [ANDROID] [FIXED] - Fix ellipsis being cut on certain font sizes Pull Request resolved: #37248 Test Plan: One piece of code where the problem could be replicated would be the one below, running on an Pixel 3A emulator. ```jsx <Text style={{padding: 27, fontSize: 30}} numberOfLines={1}> This text will be cut-off strangely in Android </Text> ``` RN-tester of the problem: | Before | With the fix | | --------------- | --------------- | | <img width="460" alt="Screenshot 2023-05-04 at 12 05 11" src="https://user-images.githubusercontent.com/25725586/236187961-d7841594-2d39-4cdc-aff9-a36f60fe6d15.png">| <img width="460" alt="Screenshot 2023-05-04 at 12 08 07" src="https://user-images.githubusercontent.com/25725586/236187999-e823beb5-0473-4940-894e-b3d2ff02c6cc.png"> | RN-Tester comparison: | Before | With the fix | | --------------- | --------------- | | <video src="https://user-images.githubusercontent.com/25725586/234273910-c6a9f55c-9a19-415d-b0cd-477c9087dac2.mp4"> | <video src="https://user-images.githubusercontent.com/25725586/234273973-ba6d5bd5-eba8-4eda-aefb-c926ea28c4e5.mp4"> | Reviewed By: javache Differential Revision: D45958303 Pulled By: NickGerleman fbshipit-source-id: 51f77702a82e60c0c18a29ee46b0aba4f37bcc28
- Loading branch information