react / react/react-native

ScrollView as child of Modal no longer scrollable on first mount/modal opening, RN >= 0.76, Android only, old-arch only

Offen
#48,822 17 Kommentare 11 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Component: Modal Component: ScrollView Needs: Triage :mag: Platform: Android
Vorherrschende Sprache
C++
Sterne
127k
Forks
25.3k
Ø Merge
1 T. 23 Std.
Gemergte PRs (30 T.)
4

Beschreibung

Description

Since React Native 0.76.0, a ScrollView as a child of the built-in Modal component is no longer scrollable when the modal first opens on Android.

This seems to only affect the old architecture. New architecture seems to be unaffected.
iOS seems unaffected.

The problem is still present in RN 0.77. Downgrading to 0.75.4 fixes it.

Steps to reproduce
  1. Install the reproduction app with yarn android. The reproduction is set to use the old architecture by default.
  2. Click the Open Scrollable Modal button.
  3. Observe that the screen doesn't scroll, even though it should.
  4. Leave the modal open. Try modifying the code in ScrollableModalContent.tsx by adding a style={{flex: 1}} to the ScrollView and saving the file. This hot-reloads the component without unmounting at the parent, and suddenly the ScrollView becomes scrollable.
  5. Close the modal using the hardware back button. Re-open the modal, observing the content is unscrollable again, even with style={{flex: 1}} still on the ScrollView.
  6. Remove the style={{flex: 1}} from the ScrollView and save the file.
  7. Enable newArch in Android gradle.properties.
  8. Rebuild the app and try opening the modal again.
  9. The modal opens and the content inside scrolls as expected.
React Native Version

0.77.0

Affected Platforms

Runtime - Android

Output of npx react-native info
System:
  OS: Linux 6.12 openSUSE Tumbleweed 20250117
  CPU: (8) x64 Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz
  Memory: 11.91 GB / 31.31 GB
  Shell:
    version: 5.2.37
    path: /bin/bash
Binaries:
  Node:
    version: 20.18.1
    path: ~/.nvm/versions/node/v20.18.1/bin/node
  Yarn:
    version: 1.22.22
    path: /usr/local/bin/yarn
  npm:
    version: 10.8.2
    path: ~/.nvm/versions/node/v20.18.1/bin/npm
  Watchman: Not Found
SDKs:
  Android SDK: Not Found
IDEs:
  Android Studio: Not Found
Languages:
  Java:
    version: 17.0.13
    path: /usr/bin/javac
  Ruby:
    version: 3.4.1
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.1
    wanted: 15.0.1
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.77.0
    wanted: 0.77.0
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: false
Stacktrace or Logs
N/A
Reproducer

https://github.com/goguda/react-native-android-scrollview-in-modal-not-always-scrolling-point-76-up

Screenshots and Videos

No response

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Führe zunächst den verknüpften Reproducer mit yarn android aus, untersuche dann ScrollableModalContent.tsx und die Android-Einstellung in gradle.properties, während du das Verhalten der alten und der neuen Architektur vergleichst. Als erledigt gilt die Aufgabe, wenn die ScrollView beim ersten Öffnen des Modals unter Android mit der alten Architektur scrollbar ist und das unveränderte Verhalten der neuen Architektur und von iOS erhalten bleibt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
android, 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
52/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.