Skip to content

Commit

Permalink
fix(android): modify text measurement cache hit rules
Browse files Browse the repository at this point in the history
  • Loading branch information
siguangli2018 committed Aug 8, 2023
1 parent 04debb2 commit f385074
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -452,9 +452,9 @@ protected Layout createLayout(final float width, final FlexMeasureMode widthMode
if (mSpanned == null || mDirty) {
mSpanned = createSpan(true);
mDirty = false;
} else if (mLayout != null && width > 0 && mLastLayoutWidth == width) {
// If the property of text node no change, and the measure width same as last time,
// no need to create layout again.
} else if (mLayout != null && width >= mLastLayoutWidth && width <= (mLastLayoutWidth + 1)) {
// If the property of text node no change, and the current layout width is equal
// to the last measurement result, no need to create layout again.
return mLayout;
}
final TextPaint textPaint = getTextPaint();
Expand Down

0 comments on commit f385074

Please sign in to comment.