[Android] A held tap on a Touchable or Pressable in ScrollView does nothing while the keyboard is up

Aperta
#4,653 7 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

@m-bert ci sta già lavorando.

Dal 10/11/2026.

  • #4685 di @m-bert — aperta

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
50/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
android, react-native, typescript
Ambito
frontend, mobile

Direzione di ricerca

Start by reading packages/react-native-gesture-handler/src/v3/components/Touchable/Touchable.tsx and packages/react-native-gesture-handler/src/v3/scrollViewInterop.ts, then compare their behavior with the linked React Native ScrollView.js touch handling. Reproduce the held-tap case from the gist on Android and inspect the example app's Keyboard Should Persist Taps screen. Done means taps in never mode dismiss the keyboard as expected, and the screen description matches the observed press behavior.

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

Descrizione

Missing repro Platform: Android
Description

On Android, in gesture-handler's ScrollView with the default keyboardShouldPersistTaps="never", while a React Native TextInput holds the keyboard, a tap on a Touchable or Pressable held past the tap timeout does nothing: the press is dropped as the keyboard-dismissing tap (#4281), yet the keyboard stays up, so the next held tap is dropped again. A quick tap closes the keyboard, and so does every tap on React Native's Pressable in React Native's ScrollView. With delaysChildPressedState={false} on the ScrollView (#4308), in a build where it takes effect (#4652), every tap does nothing, quick ones included.

In never mode React Native's ScrollView takes the touch in the capture phase and blurs the input only on release (ScrollView.js#L1454-L1482). A held button activates while the finger is still down, and its cancelsJSResponder cancel terminates that responder, so no release comes and nothing blurs the input. The press is dropped anyway (Touchable.tsx#L114-L140), since isKeyboardDismissingTap reads only the mode, the keyboard and the focused input (scrollViewInterop.ts#L42-L62). A quick tap activates the button on UP, after the release has blurred the input (#4626); without the pressed-state delay the button activates on touch down, so every tap ends the responder the same way.

Steps to reproduce
  1. Render the gist's component: a TextInput, a Touchable and a Pressable in gesture-handler's ScrollView, which leaves keyboardShouldPersistTaps at its default.
  2. Tap the input so the keyboard comes up.
  3. Hold the Touchable for 200 ms with adb shell input swipe <x> <y> <x> <y> 200, then read adb logcat -d -s ReactNativeJS:I: only [scroll view] grant and [scroll view] terminate are logged, with no onPress and no [input] blur, and the keyboard stays up. Holds of 400 ms, and the Pressable, read the same, on 3 of 3 holds each.
  4. Tap it with adb shell input tap <x> <y>: [scroll view] grant, [scroll view] release and [input] blur are logged, the keyboard closes, and the press is dropped.
  5. In the example app's Keyboard Should Persist Taps screen in never mode, holds on GH Pressable or GH Touchable do the same, while holds on the React Native panel's button close the keyboard every time.

Expected in step 3: the keyboard closes, as in steps 4 and 5.

Actual: the held press logs only the grant and the termination, fires no press and leaves the keyboard up. By hand it shows on a hold of about a second whose finger shifts slightly, as fingers do; a hold the panel reports no move for acts like a quick tap. On a Galaxy S23 (Android 14), the gist's release build, a held press on the Touchable that moves 3 px after the tap timeout (input motionevent DOWN, MOVE, UP over about a second), then a quick tap on it:

before the hold: keyboard shown
after the held press that shifts: keyboard shown
after the quick tap: keyboard hidden

and what the screen logged, the held press first:

[scroll view] grant
[scroll view] terminate
[scroll view] grant
[scroll view] release
[input] blur

The source video is here, recorded at the variable rate of screenrecord, about 13 frames a second.

With delaysChildPressedState={false} added to that screen's gesture-handler ScrollView, in a build with minification off, a quick tap reads like the hold in step 3: a grant and a termination, and the keyboard stays up.

The screen's never description still says the gesture-handler press fires as well, which #4281 changed.

A link to a Gist, an Expo Snack or a link to a repository based on this template that reproduces the bug.

https://gist.github.com/YevheniiKotyrlo/ea8a1371827b059b73dfc47ba19892de

Gesture Handler version

main at b19e23310

React Native version

0.88.0

Platforms

Android

JavaScript runtime

Hermes

Workflow

Using Expo Prebuild or an Expo development build

Build type

Release mode

Device

Android emulator

Device model

API 34 emulator (x86_64, Google APIs), Android 14

Acknowledgements

Yes

Lingua principale
TypeScript
Stelle
6.8k
Fork
1.1k
Merge medio
1g 23h
PR unite (30g)
46

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna 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.

Altre issue di software-mansion/react-native-gesture-handler

Tutte le issue di software-mansion/react-native-gesture-handler

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.