From f3850740beb641c7c1137d62c4a78d435a2b99b9 Mon Sep 17 00:00:00 2001 From: maxli Date: Tue, 8 Aug 2023 20:48:47 +0800 Subject: [PATCH] fix(android): modify text measurement cache hit rules --- .../java/com/tencent/renderer/node/TextVirtualNode.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/renderer/native/android/src/main/java/com/tencent/renderer/node/TextVirtualNode.java b/renderer/native/android/src/main/java/com/tencent/renderer/node/TextVirtualNode.java index 044fd2715ee..bfecada97ac 100644 --- a/renderer/native/android/src/main/java/com/tencent/renderer/node/TextVirtualNode.java +++ b/renderer/native/android/src/main/java/com/tencent/renderer/node/TextVirtualNode.java @@ -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();