[iOS] `<ScrollView>` struggles inside a `<Pressable>` (while it works just fine on Android)
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- C++
- Sterne
- 127k
- Forks
- 25.3k
- Ø Merge
- 1 T. 23 Std.
- Gemergte PRs (30 T.)
- 4
Beschreibung
Description
Render
<Pressable>
<ScrollView>
<Text>Anything tall, worth to scroll through... e.g. 10 paragraphs of Lorem Ipsum</Text>
</ScrollView>
</Pressable>
if you try repeatedly to scroll it on iOS, either on Simulator, or on a real device (tested with iPhone), sometimes it will scroll normally, but half of the time it won't start scrolling on your tap, like if there is an interference between the parent Pressable and the ScrollView. If you turn that Pressable into just a boring View you'll find the scrolling works just fine.
At the same time, on Android it works just fine:
ScrollViewscrolls alrightPressablecaptures (if you add itonPresshandler) on taps outsideScrollView
In other words, on Android it works as if the ScrollView is above the parent Pressable in the view stack when handling touches; and on iOS it works as they are at the same level of the stack, intercepting user touches randomly, one or another.
P.S.: Yeah, I know there is a workaround to render the same like
<>
<Pressable>...</Pressable>
<ScrollView>...</ScrollView>
</>
which works, but I don't see why the problematic variant should not work as well.
Steps to reproduce
Just run the repro app and play with the scrolling.
React Native Version
0.85.3
Affected Platforms
Runtime - iOS
Output of npx @react-native-community/cli info
info Fetching system and libraries information...
System:
OS: macOS 26.5
CPU: (12) arm64 Apple M3 Pro
Memory: 253.81 MB / 18.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 24.15.0
path: /Users/sergey_pogodin/.nvm/versions/node/v24.15.0/bin/node
Yarn:
version: 1.22.22
path: /Users/sergey_pogodin/.nvm/versions/node/v24.15.0/bin/yarn
npm:
version: 11.12.1
path: /Users/sergey_pogodin/.nvm/versions/node/v24.15.0/bin/npm
Watchman:
version: 2024.12.02.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: Not Found
Xcode:
version: 26.5/17F42
path: /usr/bin/xcodebuild
Languages:
Java: Not Found
Ruby:
version: 3.4.1
path: /opt/homebrew/opt/ruby/bin/ruby
npmPackages:
"@react-native-community/cli":
installed: 20.1.0
wanted: 20.1.0
react:
installed: 19.2.3
wanted: 19.2.3
react-native:
installed: 0.85.3
wanted: 0.85.3
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: true
newArchEnabled: true
Stacktrace or Logs
N/A
MANDATORY Reproducer
https://github.com/birdofpreyru/rn-scroll-view-bug
Screenshots and Videos
No response
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Führe zunächst den obligatorischen Reproducer unter https://github.com/birdofpreyru/rn-scroll-view-bug auf iOS aus und scrolle wiederholt in der ScrollView innerhalb von Pressable. Verfolge anschließend die iOS-Touch-Verarbeitung für Pressable und ScrollView und überprüfe dann, dass das Scrollen zuverlässig startet, während Pressable weiterhin Taps außerhalb der ScrollView verarbeitet.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- ios, react-native
- Bereich
- mobile
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 48/100