[Android] Tab screens stay clipped at a transient startup height for the whole session (onNativeLayout guard/report size mismatch)
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 74/100
调研方向
从 RCTTabView.kt 开始,跟踪布局变更监听器、其大小保护逻辑,以及报告给 JS 的 layoutHolder 尺寸。复现 issue 中描述的临时高度场景,并检查 Logcat 跟踪信息或链接 PR 中的复现。完成的标准是:后续的 layoutHolder 尺寸变化能够被报告,并且标签页界面在本次会话中不再持续处于被裁剪状态。
由索引模型根据 Issue 内容生成。
描述
Description
On Android, tab screens can get stuck clipped to a fraction of the window for the entire session: content renders in the top ~half of the screen with dead space below, while the tab bar, absolutely-positioned siblings, and pushed stack screens render normally. A force-close sometimes clears it; the race is per cold start. We observed this persistently in production on a Pixel 6a / Android 16.
Root cause
In RCTTabView.kt, the layout-change listener guards re-reporting on the outer view's size but reports the inner layoutHolder's size to JS:
val newWidth = right - left // outer view (guard)
val newHeight = bottom - top
...
val dpHeight = Utils.convertPixelsToDp(context, layoutHolder.height) // inner view (report)
...
lastReportedSize = Size(newWidth, newHeight) // stores outer size
During startup the outer frame can settle at its final size while layoutHolder is still mid-layout at a transient height. If the listener fires in that window, the transient height is reported to JS and the outer size is latched into lastReportedSize. When layoutHolder finishes laying out, the outer size hasn't changed, so the guard never allows a re-report — the transient height is styled onto every tab screen for the rest of the session.
Regression from #283, which switched the reported size to layoutHolder without switching the guard.
Reproduction
Timing-dependent in the wild, but deterministic if you simulate the transient: force layoutHolder to a non-final height when the listener first fires, then restore it (snippet in the linked PR). On current main this latches the transient height with no further report; screens stay clipped. Logcat traces for both before and after the fix are in the PR.
Fix
Key the guard on layoutHolder's own dimensions — the same view whose size is reported — so any later correct layout is detected and re-reported (self-heals in a single frame; 5 ms measured in our repro). PR incoming.
🤖 Generated with Claude Code
- 主要语言
- TypeScript
- 星标
- 1.5k
- 派生
- 110
- 平均合并
- 2 天 18 小时
- 30 天内合并 PR
- 2
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
callstack/react-native-bottom-tabs 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
-
[iOS] Fabric: SIGABRT on tab press when tab key contains non-ASCII characters (kCFStringEncodingUTF8 passed to -cStringUsingEncoding:)可能已有人在做 @thiagobrez 于 52 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
-
bug
难度 3/5 1-2 天 新手友好度 72/100
-
难度 4/5 3-5 天 新手友好度 48/100
-
难度 4/5 3-5 天 新手友好度 68/100
callstack/react-native-bottom-tabs#591 · 1 条评论 ·
查看 callstack/react-native-bottom-tabs 的全部 Issue
相似的 Issue
-
Endpoint links in the tag operations list are below the 24px target size可能已有人在做 @AdzerKI 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
ai-driven-qa bug Minor
难度 2/5 1-3 小时 新手友好度 80/100
linagora/twake-tasks#435 ·
维护者通常 1 天内回复
-
bug domain: database priority: p1 Stellar Wave
难度 2/5 1-3 小时 新手友好度 74/100
StellarState/SS-backend#632 · 1 条评论 ·
维护者通常 1 天内回复
-
A2A audit timestamps end in +00:00Z (invalid ISO 8601)可能已有人在做 @O1sumitkumar 今天认领。 未关闭bug good first issue help wanted python
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
`cf complete zsh >> .zshrc` fails on vanilla zsh可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
cloudflare/cf#340 ·
维护者通常 1 天内回复