Skip to content

Commit e08e27a

Browse files
NickGerlemanfacebook-github-bot
authored andcommitted
Support Facsimile Views in Jest E2E Text Selectors (#52070)
Summary: Pull Request resolved: #52070 Changelog: [Internal] Reviewed By: joevilches, rshest Differential Revision: D76783111 fbshipit-source-id: 5f4c3a9cf6d59eff15a071761ef83425bd4c6d23
1 parent ded4ae1 commit e08e27a

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/PreparedLayoutTextView.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import androidx.annotation.ColorInt
2323
import androidx.annotation.DoNotInline
2424
import androidx.annotation.RequiresApi
2525
import androidx.core.view.ViewCompat
26+
import com.facebook.proguard.annotations.DoNotStrip
2627
import com.facebook.react.uimanager.BackgroundStyleApplicator
2728
import com.facebook.react.uimanager.ReactCompoundView
2829
import com.facebook.react.uimanager.style.Overflow
@@ -36,6 +37,7 @@ import kotlin.math.roundToInt
3637
* existing layout, previously generated for measurement by Fabric, to ensure consistency of
3738
* measurements, and avoid duplicate work.
3839
*/
40+
@DoNotStrip
3941
internal class PreparedLayoutTextView(context: Context) : ViewGroup(context), ReactCompoundView {
4042

4143
private var clickableSpans: List<ClickableSpan> = emptyList()
@@ -74,7 +76,9 @@ internal class PreparedLayoutTextView(context: Context) : ViewGroup(context), Re
7476
@ColorInt var selectionColor: Int? = null
7577

7678
val text: CharSequence?
77-
get() = preparedLayout?.layout?.text
79+
// Avoid mangling the getter name, to allow black box E2E tests to read text content via
80+
// reflection
81+
@DoNotStrip get() = preparedLayout?.layout?.text
7882

7983
init {
8084
initView()

0 commit comments

Comments
 (0)