react / react/react-native

[iOS] `<ScrollView>` struggles inside a `<Pressable>` (while it works just fine on Android)

Ouverte
#56,879 4 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Component: ScrollView Needs: Triage :mag: Platform: Android Platform: iOS
Langage dominant
C++
Étoiles
127k
Forks
25.3k
Merge moyen
1 j 23 h
PR mergées (30 j)
4

Description

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:

  • ScrollView scrolls alright
  • Pressable captures (if you add it onPress handler) on taps outside ScrollView

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

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par exécuter le reproducteur obligatoire à l’adresse https://github.com/birdofpreyru/rn-scroll-view-bug sur iOS et faites défiler à plusieurs reprises la ScrollView à l’intérieur de Pressable. Suivez le traitement tactile iOS de Pressable et ScrollView, puis vérifiez que le défilement démarre de manière fiable tandis que Pressable continue de gérer les appuis en dehors de la ScrollView.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
ios, react-native
Domaine
mobile
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
Calme
Clarté
Plutôt claire
Accessibilité débutants
48/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.