[iOS][Fabric] ScrollView.scrollToEnd ignores adjustedContentInset
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Facilidade para iniciantes
- 78/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Pouca atividade
- Stack de tecnologia
- ios, objective-c
- Domínio
- mobile-dev
Direção de pesquisa
Leia RCTScrollViewComponentView::scrollToEnd e compare o cálculo do destino com o comportamento dos insets ajustados descrito na issue. Execute o reproducer obrigatório em um simulador iOS e, em seguida, verifique se scrollToEnd alcança o mesmo offset final que o arraste manual, incluindo o inset da safe area inferior.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Description
On iOS, ScrollView.scrollToEnd() computes its target using UIScrollView.contentInset, even when UIKit has expanded the effective scrollable area through adjustedContentInset.
This makes programmatic scrolling stop before the same end position a user can reach by dragging. The issue reproduces in the official React Native reproducer template on React Native 0.86.0 with the New Architecture. It does not require Expo, navigation, a keyboard, or an explicit contentInset.
On an iPhone 17 Pro Max simulator, stock React Native stops at offset 364 while a manual drag reaches 398. The missing 34 points exactly match the device's adjusted bottom safe-area inset.
Source-level cause
RCTScrollViewComponentView::scrollToEnd currently constructs the target with _scrollView.contentInset.bottom or .right. UIKit's safe-area and bar adjustments are represented by _scrollView.adjustedContentInset, so the command omits the system-provided part of the scrollable range.
Current source:
CGFloat offsetY = _scrollView.contentSize.height - _scrollView.bounds.size.height + _scrollView.contentInset.bottom;
Using adjustedContentInset makes the command reach the same end as a manual drag.
Relationship to #56189
This is related to, but not fixed by, #56189.
That PR moves scrollTo clamping into scrollToOffset and clamps against adjustedContentInset. I built React Native from source with that PR's effective Fabric logic:
| Action with #56189 logic | Final vertical offset |
|---|---|
scrollTo({y: 9999}) |
398 (fixed) |
scrollToEnd() |
364 (still incorrect) |
scrollToEnd() constructs an already-valid target of 364 before calling scrollToOffset, so later clamping correctly leaves that target unchanged. Changing only scrollToEnd() to construct its target from adjustedContentInset makes it reach 398.
Steps to reproduce
- Clone the mandatory reproducer, which starts from
react-native-community/reproducer-react-nativeat React Native 0.86.0. - Run
cd ReproducerApp && yarn install. - Run
cd ios && pod install && cd ... - Run
yarn ioson an iOS simulator with a bottom safe area. - Tap scrollToEnd.
- Observe
offset 364 / raw 364 / adjusted 398 / safe bottom 34. - Tap Reset, then drag the scroll view manually to its end.
- Observe that manual scrolling reaches 398.
The reproducer uses one plain vertical ScrollView:
<ScrollView
ref={scrollViewRef}
contentInsetAdjustmentBehavior="always"
>
{/* content taller than the viewport */}
</ScrollView>
and invokes:
scrollViewRef.current?.scrollToEnd({animated: false});
React Native Version
0.86.0
Affected Platforms
Runtime - iOS
Areas
Fabric - The New Renderer
Output of npx @react-native-community/cli info
System:
OS: macOS 26.5.1
CPU: (12) arm64 Apple M4 Pro
Memory: 133.78 MB / 24.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 25.5.0
path: /opt/homebrew/bin/node
Yarn: Not Found
npm:
version: 11.8.0
path: /opt/homebrew/bin/npm
Watchman:
version: 2026.01.12.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.16.2
path: /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 25.5
- iOS 26.5
- macOS 26.5
- tvOS 26.5
- visionOS 26.5
- watchOS 26.5
Android SDK: Not Found
IDEs:
Android Studio: 2025.1 AI-251.26094.121.2513.14007798
Xcode:
version: 26.6/17F113
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.16
path: /usr/bin/javac
Ruby:
version: 2.6.10
path: /usr/bin/ruby
npmPackages:
react:
installed: 19.2.3
wanted: 19.2.3
react-native:
installed: 0.86.0
wanted: 0.86.0
iOS:
New Architecture: enabled by the official reproducer template
Stacktrace or Logs
There is no crash. The deterministic runtime measurements are:
| Native implementation | scrollToEnd() |
scrollTo({y: 9999}) |
Manual end |
|---|---|---|---|
| Stock React Native 0.86.0 | 364 | 364 | 398 |
| #56189 effective Fabric logic | 364 | 398 | 398 |
#56189 logic plus the scrollToEnd fix |
398 | 398 | 398 |
All native variants were compiled from source before testing.
MANDATORY Reproducer
https://github.com/eliotgevers/react-native-scroll-to-end-adjusted-inset-repro
Screenshots and Videos
| Stock React Native 0.86.0 | Patched native source |
|---|---|
scrollToEnd() stops at 364 and cuts off the true end marker. |
scrollToEnd() reaches the adjusted end at 398. |
![]() |
![]() |
- Linguagem predominante
- C++
- Estrelas
- 127k
- Forks
- 25.3k
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de react/react-native
-
Needs: Author Feedback Needs: Repro
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 92/100
react/react-native#58621 · 1 comentário ·
-
Needs: Author Feedback Needs: Repro
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
react/react-native#58610 · 1 comentário ·
-
Needs: Triage :mag:
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
react/react-native#58565 · 1 comentário · 2 reações ·
-
Needs: Author Feedback Needs: Repro
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
react/react-native#58555 · 4 comentários · 1 reação ·
-
Needs: Attention Needs: Repro
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
react/react-native#58526 · 2 comentários ·
Todas as issues de react/react-native
Issues semelhantes
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 90/100
AXERA-TECH/ax-llm#77 ·
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 90/100
games-on-whales/wolf#509 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
-
bug-unconfirmed
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
NVIDIA/cuda-samples#453 ·

