fix(ohos): pull-to-refresh contentInset offset rests at 0 under margin model, not -inset.top - #102
Merged
Merged
Conversation
…n model, not -inset.top
OHOS realizes KRScrollerView contentInset via an ArkUI margin (physical
top shift). SetContentInset's animate path snapped the content offset to
MaxContentOffsetInContentInset's top target -inset.top (iOS resting-offset
semantics) and then applied margin(top=inset.top); during a held refresh
inset the offset(-top) and margin(top) double-count, so the Activity
pull-to-refresh showed ~2x (160vp / ~180dp) top blank. iOS is unaffected
(native contentInset shifts the origin); this file is core-render-ohos only.
Under the margin model the top resting offset is 0, so clamp top-overscroll
to {0,0}. The recycle path (inset top=0) still clamps a residual negative
offset to 0. The helper is used only by SetContentInset, so normal
scroll/inertia clamps are untouched. The symmetric horizontal `start`
branch is a separate latent case, not exercised by task #110, left as
follow-up.
task #110 — pending HOP-AL10 device verification.
Signed-off-by: PaoDing <raft-mobile-paoding@mail.build>
Signed-off-by: HanXin <hanxin@mail.build>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
bytemain
force-pushed
the
hanxin/ohos-pull-refresh-inset-1x
branch
from
August 1, 2026 07:18
19f2948 to
64a0fc6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem (Raft task #110)
On OpenHarmony, the Activity pull-to-refresh showed a ~2× (~180dp) top blank that stayed for the entire refresh, with the spinner centered in it. Android/iOS are unaffected.
Root cause
OHOS realizes
KRScrollerViewcontentInsetas an ArkUI margin (a physical top shift). ButSetContentInset's animate path snaps the content offset toMaxContentOffsetInContentInset, whose top-overscroll branch returns{0, -content_inset->top}— the iOS resting-offset semantics — and then appliesSetArkUIMargin(top=inset.top). During a held refresh inset (top=80), offset-80+ margin80double-count = 160vp ≈ 180dp = 2×. iOS is correct because its nativecontentInsetshifts the coordinate origin (no margin); this file iscore-render-ohosonly.Fix
Under the margin model the top resting offset is 0, so clamp top-overscroll to
{0, 0}. Release then settles to offset 0 + margin 80 = 1×; the recycle path (inset top=0) still clamps a residual negative offset to 0.MaxContentOffsetInContentInsetis used only bySetContentInset→ low blast radius, normal scroll/inertia clamps untouched.startbranch is the same latent class but is not exercised by task fix(compose): redraw restored lazy descendants #110 (vertical/top); left as a separate follow-up, intentionally not bundled.On-device verification (HOP-AL10, HarmonyOS)
53e5892fdpins forkb57fc344(this PR's parent) via gitlink +kuikly-render-staging2-b57fc344.har; candidate carrierecf8d9816advances only that fork to19f29487. Nativelibkuikly.soBuildId changede4077a2b…→bfa3d280…(HAP5c0fd527…), proving the device runs this exact change and not a stale HAR — the only runtime delta is this one commit.-inset.top, so a release-timeoffset -80 + margin 80(2×) is impossible by construction; the observed transient 2× can only come from finger-driven overscroll during the drag.Credits: localization @赵梓淇/Cindy · Android oracle + repro @pixel · device verification & build provenance @ark.
Author: HanXin (see
Signed-off-by). Per our flow the author does not self-merge — a permitted maintainer presses.