[Android] One-frame jump on prepend with maintainVisibleContentPosition
維護者通常 1 天內回覆
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 55/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 活躍
- 技術堆疊
- android, react-native
研究方向
首先執行必要的重現 repo,並閱讀 MaintainVisibleScrollPositionHelper.didMountItems 以及 ReactScrollView.scrollToPreservingMomentum。追蹤 scroll view 為什麼沒有在 mount 的同一個 frame 內失效。在所述條件下將項目插入開頭時不再出現一個 frame 的跳動,包括重現案例,即表示完成。
由索引模型根據 Issue 內容生成。
描述
Description
On Android with New Architecture, a ScrollView with maintainVisibleContentPosition draws one stale frame when an item is prepended. The rows move down by the height of the new item for one frame, then move back. In a chat list with live traffic this happens on every incoming message
The bug needs two conditions, both can be encountered when utilising virtualised list (observed first with LegendList 3):
- The anchor child and the item children move in the same Fabric mount, so the helper corrects the scroll offset for that mount
- Nothing in that mount changes the size of the content container. In LegendList the container height is an
Animated.Value, so it reaches native in a separate update. If the content resizes in the same mount, the layout pass invalidates theScrollViewand the frame is correct. That is why a plain prepend of flex children does not show it
The stale frame comes from MaintainVisibleScrollPositionHelper. In didMountItems it calls scrollToPreservingMomentum on the ReactScrollView, but nothing invalidates the ScrollView in that frame. View.scrollTo only calls postInvalidateOnAnimation, which lands in the next frame. The moved children have already invalidated themselves for the current frame, so the current frame draws the new child positions through the old ScrollView display list, which still holds translate(-oldScrollY)
Steps to reproduce
- Clone Reproduction repo and run
yarn && yarn android(yarn berry) - Watch the list
- Tap invalidate
ScrollViewafter mount to see the jump stop
React Native Version
0.86.3
Affected Platforms
Runtime - Android
Areas
Fabric - The New Renderer
Output of npx @react-native-community/cli info
System:
OS: macOS 26.6.2
CPU: (14) arm64 Apple M4 Pro
Memory: 225.94 MB / 24.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 20.19.6
path: /Users/szymon/.local/share/mise/installs/node/20.19.6/bin/node
Yarn:
version: 4.18.0
path: /Users/szymon/.local/share/mise/installs/node/20.19.6/bin/yarn
npm:
version: 10.8.2
path: /Users/szymon/.local/share/mise/installs/node/20.19.6/bin/npm
Watchman:
version: 2026.07.27.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.17.0
path: /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 25.2
- iOS 26.2
- macOS 26.2
- tvOS 26.2
- visionOS 26.2
- watchOS 26.2
Android SDK:
API Levels:
- "31"
- "35"
- "36"
Build Tools:
- 35.0.0
- 36.0.0
- 36.1.0
System Images:
- android-35 | Google APIs ARM 64 v8a
- android-35 | Google Play ARM 64 v8a
- android-35 | Pre-Release 16 KB Page Size Google APIs ARM 64 v8a
- android-36.1 | Pre-Release 16 KB Page Size Google APIs ARM 64 v8a
Android NDK: Not Found
IDEs:
Android Studio: 2025.3 AI-253.30387.90.2532.14935130
Xcode:
version: 26.3/17C529
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.20
path: /usr/bin/javac
Ruby:
version: 3.4.9
path: /Users/szymon/.local/share/mise/installs/ruby/3.4.9/bin/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 19.2.3
wanted: 19.2.3
react-native:
installed: 0.86.3
wanted: 0.86.3
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: Not found
newArchEnabled: Not found
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
Stacktrace or Logs
Do not apply
MANDATORY Reproducer
https://github.com/Critteros/rn-android-mvcp-one-frame-jump
Screenshots and Videos
Reproduction:
https://github.com/user-attachments/assets/8e3991da-a158-4377-a240-2063e9722c8e
With invalidation:
https://github.com/user-attachments/assets/4731c14c-cf92-463f-b6c2-2e8917145aa8
- 主要語言
- C++
- 星號
- 127k
- 分支
- 25.3k
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
react/react-native 的其他 Issue
-
Needs: Author Feedback Needs: Repro
難度 2/5 1-3 小時 新手友好度 76/100
react/react-native#58952 · 1 則留言 ·
維護者通常 1 天內回覆
-
Needs: Attention Needs: Repro
難度 2/5 1-3 小時 新手友好度 78/100
react/react-native#58904 · 2 則留言 ·
維護者通常 1 天內回覆
-
Needs: Author Feedback Needs: Repro
難度 2/5 1-3 小時 新手友好度 75/100
react/react-native#58659 · 2 則留言 ·
維護者通常 1 天內回覆
-
Needs: Author Feedback Needs: Repro
難度 1/5 1 小時以內 新手友好度 92/100
react/react-native#58621 · 1 則留言 ·
維護者通常 1 天內回覆
-
Add TypeScript declaration for the performance global可能已有人在做 @Cedric921 於 7 天前認領。 未關閉Needs: Attention Needs: Repro
難度 2/5 1-3 小時 新手友好度 85/100
react/react-native#58610 · 4 則留言 ·
維護者通常 1 天內回覆
查看 react/react-native 的全部 Issue
相似的 Issue
-
Incorrect Link in README.md可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉
難度 1/5 1 小時以內 新手友好度 95/100
flameshot-org/flameshot#4996 ·
維護者通常 2 天內回覆
-
難度 2/5 1-3 小時 新手友好度 64/100
utopia-rise/godot-jvm#1004 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 70/100
維護者通常 3 天內回覆
-
難度 2/5 1-3 小時 新手友好度 70/100
維護者通常 1 天內回覆
-
chore(build): TxCoordinator.cpp uses the deprecated shared_ptr atomic free functions可能已有人在做 @w5jwp 今天認領。 未關閉
難度 1/5 1 小時以內 新手友好度 84/100
aethersdr/AetherSDR#6368 · 1 則留言 ·
維護者通常 1 天內回覆