Fix mising ANTI_ALIAS_FLAG when resetting Text Paint (#46848)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46848

D63303172 introduced a bug showing truncation on versions of Android <= 28. I tracked this down to `ANTI_ALIAS_FLAG` getting cleared when we reset the paint. This applies it again after resetting, for consistency with previous behavior, and TextView.

This bug doesn't effect newer versions of Android, since API 29+ applies this flag by default. https://github.com/aosp-mirror/platform_frameworks_base/commit/47c51fe80e3dd9d6b518c11c2e1714c271835af5#diff-57b6a0bc3755a19d1faf73c130b0e56e8e13930148c5434666c5a186aeb01c78R256

Changelog:
[Android][Fixed] - Fix mising `ANTI_ALIAS_FLAG` when resetting Text Paint

Reviewed By: javache

Differential Revision: D63930051

fbshipit-source-id: bb4c98834954637b0a8f0dba8502188626a68b54
This commit is contained in:
Nick Gerleman
2024-10-07 10:34:32 -07:00
committed by Facebook GitHub Bot
parent 8bbd3a8fb4
commit 276e3a7df7
@@ -435,6 +435,7 @@ public class TextLayoutManager {
// hypothetical height of a new line after a trailing newline charater (considered part of the
// previous line).
paint.reset();
paint.setAntiAlias(true);
if (baseTextAttributes.getEffectiveFontSize() != ReactConstants.UNSET) {
paint.setTextSize(baseTextAttributes.getEffectiveFontSize());
}