react / react/react-native

Android: Scroll View Stretch Effect Inconsistency

Aperta
#57,506 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Needs: Triage :mag: Platform: Android
Lingua principale
C++
Stelle
127k
Fork
25.3k
Merge medio
1g 23h
PR unite (30g)
4

Descrizione

Description

Tested on Android Pixel 9.

I am trying to understand an issue. I found some threads. #35424 and #47021. When I use a ScrollView with overScrollMode="always" and the content is smaller than the ScrollView the stretch effect does not show when I drag on a child view.. It works fine when I use a horizontal scroll.

I looked into Androids ScrollView code. It has a return in onInterceptTouchEvent:

// Don't try to intercept touch if we can't scroll anyway.
if (getScrollY() == 0 && !canScrollVertically(1)) {
    return false;
}

Is this a correct fix?

@Override
boolean canScrollVertically(int direction) {
    return super.canScrollVertically(direction)
    || (direction > 0. MScrollEnabled && getOverScrollMode() == OVER_SCROLL_ALWAYS);
}

If I set ALWAYS the view can give feedback. So reporting it as scrollable will fix the issue... Accessibility and nested-scroll parents will also see the view, as scrollable in that mode.

Steps to reproduce

Create a ScrollView with some text children:

<ScrollView style={{ height: 150 }} overScrollMode="always">
    <Text style={{ padding: 8 }}>Row one</Text>
    <Text style={{ padding: 8 }}>Row two</Text>
</ScrollView>

The difference:

  • If I set the scroll to horizontal there is a visible Stretch effect no matter where I drag from.
  • If I set it to vertical it does not work when I tap and drag from the Text.
React Native Version

React-native 0.85.3

Affected Platforms

Runtime - Android

Output of npx @react-native-community/cli info
System:
  OS: macOS 26.5.1
  CPU: (12) arm64 Apple M2 Pro
  Memory: 316.38 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 24.1.0
    path: /Users/davidmalesevic/.nvm/versions/node/v24.1.0/bin/node
  Yarn: Not Found
  npm:
    version: 11.7.0
    path: /Users/davidmalesevic/.nvm/versions/node/v24.1.0/bin/npm
  Watchman: Not Found
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.2 AI-252.28238.7.2523.14688667
  Xcode:
    version: 26.6/17F113
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.18
    path: /opt/homebrew/opt/openjdk@17/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  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: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found
Stacktrace or Logs
N/A
MANDATORY Reproducer

https://github.com/Alforofous/rn-vertical-stretch-repro

Screenshots and Videos
Image

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia eseguendo il reproducer obbligatorio e confronta il comportamento della ScrollView verticale e orizzontale con overScrollMode="always". Leggi la logica di onInterceptTouchEvent e canScrollVertically di Android ScrollView, quindi segui l’integrazione di React Native ScrollView. Il lavoro è completato quando il trascinamento da un child produce l’effetto di stiramento verticale senza modifiche indesiderate all’accessibilità o allo scorrimento nidificato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
android, react-native
Ambito
mobile-dev
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
52/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.