Repository navigation
Description
Description
A ScrollView cannot be scrolled to a child that overflows its content container, such as an absolutely positioned View placed past the container's end, though its own scrollHeight counts that child. In the reproducer a 400-point-high ScrollView holds a 400-point-high content container whose absolutely positioned child sits at top: 400, 300 points high: scrollHeight reads 700 and clientHeight 400, yet scrollToEnd() leaves the offset at 0. On the web a scroll container's scrollable overflow holds every box it contains, overflowing ones included (css-overflow-3), so the same layout scrolls 300 points.
ScrollViewShadowNode::updateStateIfNeeded bounds the content by its children's frames alone (ScrollViewShadowNode.cpp L18-L31), iOS takes the scroll view's contentSize from that state (RCTScrollViewComponentView.mm L542-L552), and Android's ReactScrollView.getMaxScrollY() reads the content view's height (ReactScrollView.kt L773-L777), while getScrollSize, which scrollHeight reads, bounds the content by getContentBounds(), which counts each child's overflow (DOM.cpp L385-L414). The content has been bounded by the children's frames since Fabric's ScrollView came in, bd99d3a. I ran the reproducer on Android.
Steps to reproduce
-
Clone the reproducer and, with one Android device attached, run
bash ./reproduce.sh. It builds and installs the release app, which callsscrollToEnd()half a second after it mounts and a second later showsscrollHeight,clientHeightand the offset reached. The script reads that line and exits 1 while the offset stays short ofscrollHeight - clientHeight, 0 once it reaches it. -
Or by hand: build and install the release app (
cd ReproducerApp && yarn install && cd android && ./gradlew assembleRelease && adb install -r app/build/outputs/apk/release/app-release.apk) and open it. The ScrollView:<ScrollView ref={scrollView} style={{ flexGrow: 0, width: 200, height: 400 }}> <View style={{ height: 400, backgroundColor: '#d3d3d3' }}> <View style={{ position: 'absolute', top: 400, width: 100, height: 300, backgroundColor: '#ff0000' }} /> </View> </ScrollView>
Expected: the ScrollView scrolls to 300, the red View's end, which its scrollHeight of 700 counts.
Seen: scrollHeight 700, clientHeight 400, scrolled to 0.
React Native Version
0.90.0-nightly-20261128-32260ddbe
Affected Platforms
Runtime - Android, Runtime - iOS
Output of npx @react-native-community/cli info
[…]
info Fetching system and libraries information...
System:
OS: Windows 11 10.0.26300
CPU: "(32) x64 AMD Ryzen 9 9950X3D 16-Core Processor "
Memory: 105.56 GB / 255.67 GB
Binaries:
Node:
version: 26.12.1
path: C:\Program Files\nodejs\node.EXE
Yarn:
version: 1.22.22
path: C:\Users\<user>\AppData\Roaming\npm\yarn.CMD
npm:
version: 12.2.1
path: C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK: Not Found
Windows SDK:
AllowDevelopmentWithoutDevLicense: Enabled
Versions:
- 10.0.19041.0
- 10.0.26100.0
IDEs:
Android Studio: AI-262.9437.185.2621.16467767
Visual Studio: Not Found
Languages:
Java:
version: 17.0.20.1
path: C:\Program Files\Microsoft\jdk-17.0.20.101-hotspot\bin\javac.EXE
Ruby: Not Found
npmPackages:
"@react-native-community/cli":
installed: 22.0.0-alpha.0
wanted: 22.0.0-alpha.0
react:
installed: 19.3.0
wanted: 19.3.0
react-native:
installed: 0.90.0-nightly-20261128-32260ddbe
wanted: 0.90.0-nightly-20261128-32260ddbe
react-native-windows: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
Stacktrace or Logs
MINGW64_NT-10.0-26300 x86_64, node v26.12.1, openjdk version "17.0.20.1" 2026-08-18 LTS
device: Mi MIX 3, Android 10 (API 29), arm64-v8a
react-native 0.90.0-nightly-20261128-32260ddbe
== ./gradlew :app:assembleRelease -PreactNativeArchitectures=arm64-v8a
scrollHeight 700, clientHeight 400, scrolled to 0
SUMMARY: the ScrollView scrolls to 0, short of the 300 its scrollHeight of 700 gives over a 400 viewport; exit 1
MANDATORY Reproducer
https://github.com/YevheniiKotyrlo/rn-scrollview-overflow-range
Screenshots and Videos
No response
Activity