Cleanup heightOfTallestInlineImage field (#52978)

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

This field is never written anywhere (neither in the internal codebase, nor in OSS).
I'm cleaning this us and simplifying the logic:
- Deprecating `effectiveLineHeight`
- Replacing all the usage of `effectiveLineHeight` with just `lineHeight`

Changelog:
[Android] [Changed] - Deprecate the field `TextAttributeProps.effectiveLineHeight`. This field was public but never used in OSS.

Reviewed By: mdvacca

Differential Revision: D79442393

fbshipit-source-id: c424a6def0257264cd160a2d7be48c2d0f47135e
This commit is contained in:
Nicola Corti
2025-08-07 09:49:46 -07:00
committed by Facebook GitHub Bot
parent fa921b3c7b
commit ede037ade7
2 changed files with 6 additions and 17 deletions
@@ -134,17 +134,9 @@ public class TextAttributeProps private constructor() {
public var fontFeatureSettings: String? = null
private set
private var heightOfTallestInlineImage: Float = Float.NaN
@Deprecated("Use lineHeight instead", ReplaceWith("lineHeight"))
public val effectiveLineHeight: Float
// Returns a line height which takes into account the requested line height
get() {
val useInlineViewHeight =
!lineHeight.isNaN() &&
!heightOfTallestInlineImage.isNaN() &&
heightOfTallestInlineImage > lineHeight
return if (useInlineViewHeight) heightOfTallestInlineImage else lineHeight
}
get() = lineHeight
private fun setNumberOfLines(numberOfLines: Int) {
this.numberOfLines = if (numberOfLines == 0) ReactConstants.UNSET else numberOfLines
@@ -312,10 +312,8 @@ internal object TextLayoutManager {
textAttributes.textShadowRadius,
textAttributes.textShadowColor)))
}
if (!textAttributes.effectiveLineHeight.isNaN()) {
ops.add(
SetSpanOperation(
start, end, CustomLineHeightSpan(textAttributes.effectiveLineHeight)))
if (!textAttributes.lineHeight.isNaN()) {
ops.add(SetSpanOperation(start, end, CustomLineHeightSpan(textAttributes.lineHeight)))
}
if (ReactNativeFeatureFlags.enablePreparedTextLayout()) {
@@ -474,9 +472,8 @@ internal object TextLayoutManager {
spanFlags)
}
if (!fragment.props.effectiveLineHeight.isNaN()) {
spannable.setSpan(
CustomLineHeightSpan(fragment.props.effectiveLineHeight), start, end, spanFlags)
if (!fragment.props.lineHeight.isNaN()) {
spannable.setSpan(CustomLineHeightSpan(fragment.props.lineHeight), start, end, spanFlags)
}
if (ReactNativeFeatureFlags.enablePreparedTextLayout()) {