Skip to content

Commit c6bfe78

Browse files
committed
refactor(android): name visual bounds probe width
1 parent 2407f92 commit c6bfe78

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ internal object TextLayoutManager {
118118

119119
private const val TEXT_WIDTH_MODE_LONGEST_LINE = "longest-line"
120120

121+
// Large enough to avoid wrapping while leaving room for Android layout arithmetic.
122+
private const val VISUAL_BOUNDS_PROBE_WIDTH = Int.MAX_VALUE / 2
123+
121124
private val tagToSpannableCache = ConcurrentHashMap<Int, Spannable>()
122125

123126
// These wrappers mirror Android 15 APIs but use reflection because some internal targets still
@@ -1040,7 +1043,7 @@ internal object TextLayoutManager {
10401043
val visualBoundsLayout =
10411044
buildLayout(
10421045
text,
1043-
Int.MAX_VALUE / 2,
1046+
VISUAL_BOUNDS_PROBE_WIDTH,
10441047
includeFontPadding,
10451048
textBreakStrategy,
10461049
hyphenationFrequency,

0 commit comments

Comments
 (0)