Skip to content

Commit ede037a

Browse files
cortinicofacebook-github-bot
authored andcommitted
Cleanup heightOfTallestInlineImage field (#52978)
Summary: Pull Request resolved: #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
1 parent fa921b3 commit ede037a

2 files changed

Lines changed: 6 additions & 17 deletions

File tree

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

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,17 +134,9 @@ public class TextAttributeProps private constructor() {
134134
public var fontFeatureSettings: String? = null
135135
private set
136136

137-
private var heightOfTallestInlineImage: Float = Float.NaN
138-
137+
@Deprecated("Use lineHeight instead", ReplaceWith("lineHeight"))
139138
public val effectiveLineHeight: Float
140-
// Returns a line height which takes into account the requested line height
141-
get() {
142-
val useInlineViewHeight =
143-
!lineHeight.isNaN() &&
144-
!heightOfTallestInlineImage.isNaN() &&
145-
heightOfTallestInlineImage > lineHeight
146-
return if (useInlineViewHeight) heightOfTallestInlineImage else lineHeight
147-
}
139+
get() = lineHeight
148140

149141
private fun setNumberOfLines(numberOfLines: Int) {
150142
this.numberOfLines = if (numberOfLines == 0) ReactConstants.UNSET else numberOfLines

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

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -312,10 +312,8 @@ internal object TextLayoutManager {
312312
textAttributes.textShadowRadius,
313313
textAttributes.textShadowColor)))
314314
}
315-
if (!textAttributes.effectiveLineHeight.isNaN()) {
316-
ops.add(
317-
SetSpanOperation(
318-
start, end, CustomLineHeightSpan(textAttributes.effectiveLineHeight)))
315+
if (!textAttributes.lineHeight.isNaN()) {
316+
ops.add(SetSpanOperation(start, end, CustomLineHeightSpan(textAttributes.lineHeight)))
319317
}
320318

321319
if (ReactNativeFeatureFlags.enablePreparedTextLayout()) {
@@ -474,9 +472,8 @@ internal object TextLayoutManager {
474472
spanFlags)
475473
}
476474

477-
if (!fragment.props.effectiveLineHeight.isNaN()) {
478-
spannable.setSpan(
479-
CustomLineHeightSpan(fragment.props.effectiveLineHeight), start, end, spanFlags)
475+
if (!fragment.props.lineHeight.isNaN()) {
476+
spannable.setSpan(CustomLineHeightSpan(fragment.props.lineHeight), start, end, spanFlags)
480477
}
481478

482479
if (ReactNativeFeatureFlags.enablePreparedTextLayout()) {

0 commit comments

Comments
 (0)