From 0da4ded574c84065e907f2bca2fae7a72793a6a4 Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Sat, 14 Feb 2026 03:06:48 -0800 Subject: [PATCH] Cleanup PreparedLayoutTextView Recycling Summary: Everything in `initView` is already initialized implicitly, so should only be called during recycling, where we are also missing `selectionColor`. Changelog: [internal] Differential Revision: D93327082 --- .../react/views/text/PreparedLayoutTextView.kt | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/PreparedLayoutTextView.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/PreparedLayoutTextView.kt index afd3cefc09e0..6b9ba111099d 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/PreparedLayoutTextView.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/PreparedLayoutTextView.kt @@ -85,21 +85,17 @@ internal class PreparedLayoutTextView(context: Context) : ViewGroup(context), Re @DoNotStrip get() = preparedLayout?.layout?.text init { - initView() // ViewGroup by default says only its children will draw setWillNotDraw(false) } - private fun initView() { - clickableSpans = emptyList() - selection = null - preparedLayout = null - } - fun recycleView(): Unit { - initView() BackgroundStyleApplicator.reset(this) overflow = Overflow.HIDDEN + clickableSpans = emptyList() + selection = null + selectionColor = null + preparedLayout = null } override fun onDraw(canvas: Canvas) {