Skip to content

Commit 4e1d7f6

Browse files
committed
Fix adjustsFontSizeToFit clipping when container height shrinks on Android
1 parent b587763 commit 4e1d7f6

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

  • packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,14 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
313313
}
314314
}
315315

316+
@Override
317+
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
318+
super.onSizeChanged(w, h, oldw, oldh);
319+
if (mAdjustsFontSizeToFit && (w != oldw || h != oldh)) {
320+
mShouldAdjustSpannableFontSize = true;
321+
}
322+
}
323+
316324
public void setText(ReactTextUpdate update) {
317325
try (SystraceSection s = new SystraceSection("ReactTextView.setText(ReactTextUpdate)")) {
318326
// Android's TextView crashes when it tries to relayout if LayoutParams are

0 commit comments

Comments
 (0)