From 276e3a7df7de1b04dec0891fa7ed72917568ee7b Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Mon, 7 Oct 2024 10:34:32 -0700 Subject: [PATCH] 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 --- .../java/com/facebook/react/views/text/TextLayoutManager.java | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.java index 6c4fda37a06..6e22ae9f409 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.java @@ -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()); }