Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pressable onPress fires when scrolling FlatList #48488

Open
Tobbe opened this issue Jan 4, 2025 · 1 comment
Open

Pressable onPress fires when scrolling FlatList #48488

Tobbe opened this issue Jan 4, 2025 · 1 comment
Labels
Component: FlatList Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. Needs: Author Feedback

Comments

@Tobbe
Copy link

Tobbe commented Jan 4, 2025

Description

When you have a list of <Pressable> inside a <FlatList>, and the list is short enough to fully fit on the screen (so that no scrolling is actually needed), then if you do scroll the list a whole bunch of onPress events will fire on the Pressable list items.

The expected behavior is that onPress should only be triggered when actually pressing an item.

I initially filed this report on the FlashList repo, but after further testing I actually believe this is a React Native issue.
Here's the FlashList issue: Shopify/flash-list#1461
Here's an older very similar React Native issue that's been closed without a fix: #27355

Steps to reproduce

See the linked FlashList issue for the code and steps needed to reproduce

React Native Version

0.76.5

Affected Platforms

Runtime - Android

Output of npx react-native info

System:
  OS: macOS 15.1.1
  CPU: (12) arm64 Apple M3 Pro
  Memory: 560.73 MB / 36.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.18.1
    path: /usr/local/bin/node
  Yarn:
    version: 4.5.1
    path: /usr/local/bin/yarn
  npm:
    version: 10.8.2
    path: /usr/local/bin/npm
  Watchman:
    version: 2024.12.02.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods: Not Found
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.1
      - iOS 18.1
      - macOS 15.1
      - tvOS 18.1
      - visionOS 2.1
      - watchOS 11.1
  Android SDK:
    API Levels:
      - "34"
      - "35"
    Build Tools:
      - 34.0.0
      - 35.0.0
    System Images:
      - android-34 | Google Play ARM 64 v8a
      - android-35 | Google APIs ARM 64 v8a
      - android-35 | Google Play ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2024.2 AI-242.23339.11.2421.12700392
  Xcode:
    version: 16.1/16B40
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.13
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /Users/tobbe/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.1.3
    wanted: ^15.1.3
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.76.5
    wanted: 0.76.5
  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

(NOBRIDGE) LOG  {"item": {"id": "3ac68afc-c605-48d3-a4f8-fbd91aa97f63", "title": "Second Item"}}
 (NOBRIDGE) LOG  {"item": {"id": "58694a0f-3da1-471f-bd96-145571e29d72", "title": "Third Item"}}
 (NOBRIDGE) LOG  {"item": {"id": "58694a0f-3da1-471f-bd96-145571e29d72", "title": "Third Item"}}
 (NOBRIDGE) LOG  {"item": {"id": "58694a0f-3da1-471f-bd96-145571e29d72", "title": "Third Item"}}
 (NOBRIDGE) LOG  {"item": {"id": "58694a0f-3da1-471f-bd96-145571e29d72", "title": "Third Item"}}
 (NOBRIDGE) LOG  {"item": {"id": "58694a0f-3da1-471f-bd96-145571e29d72", "title": "Third Item"}}
 (NOBRIDGE) LOG  {"item": {"id": "bd7acbea-c1b1-46c2-aed5-3ad53abb28ba", "title": "First Item"}}
 (NOBRIDGE) LOG  {"item": {"id": "3ac68afc-c605-48d3-a4f8-fbd91aa97f63", "title": "Second Item"}}
 (NOBRIDGE) LOG  {"item": {"id": "3ac68afc-c605-48d3-a4f8-fbd91aa97f63", "title": "Second Item"}}
 (NOBRIDGE) LOG  {"item": {"id": "3ac68afc-c605-48d3-a4f8-fbd91aa97f63", "title": "Second Item"}}
 (NOBRIDGE) LOG  {"item": {"id": "58694a0f-3da1-471f-bd96-145571e29d72", "title": "Third Item"}}
 (NOBRIDGE) LOG  {"item": {"id": "58694a0f-3da1-471f-bd96-145571e29d72", "title": "Third Item"}}
 (NOBRIDGE) LOG  {"item": {"id": "58694a0f-3da1-471f-bd96-145571e29d72", "title": "Third Item"}}
 (NOBRIDGE) LOG  {"item": {"id": "58694a0f-3da1-471f-bd96-145571e29d72", "title": "Third Item"}}
 (NOBRIDGE) LOG  {"item": {"id": "3ac68afc-c605-48d3-a4f8-fbd91aa97f63", "title": "Second Item"}}
 (NOBRIDGE) LOG  {"item": {"id": "bd7acbea-c1b1-46c2-aed5-3ad53abb28ba", "title": "First Item"}}
 (NOBRIDGE) LOG  {"item": {"id": "bd7acbea-c1b1-46c2-aed5-3ad53abb28ba", "title": "First Item"}}
 (NOBRIDGE) LOG  {"item": {"id": "bd7acbea-c1b1-46c2-aed5-3ad53abb28ba", "title": "First Item"}}
 (NOBRIDGE) LOG  {"item": {"id": "58694a0f-3da1-471f-bd96-145571e29d72", "title": "Third Item"}}
 (NOBRIDGE) LOG  {"item": {"id": "58694a0f-3da1-471f-bd96-145571e29d72", "title": "Third Item"}}

Reproducer

https://github.com/Tobbe/expo-bun-flash-list-issue

Screenshots and Videos

Screen.Recording.2025-01-03.at.23.14.22.mov
@mensonones
Copy link

Hey! I tried to reproduce your issue, but I couldn't replicate it. Attached is a video.

System:
OS: Linux 6.8 Ubuntu 22.04.5 LTS 22.04.5 LTS (Jammy Jellyfish)
CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
Memory: 11.02 GB / 31.13 GB
Shell:
version: 5.1.16
path: /bin/bash
Binaries:
Node:
version: 20.12.2
path: /usr/local/bin/node
Yarn:
version: 1.22.22
path: /usr/local/bin/yarn
npm:
version: 10.5.0
path: /usr/local/bin/npm
Watchman:
version: 4.9.0
path: /usr/bin/watchman
SDKs:
Android SDK: Not Found
IDEs:
Android Studio: Not Found
Languages:
Java:
version: 17.0.13
path: /usr/bin/javac
Ruby: Not Found
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.76.5
wanted: 0.76.5
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: Not found
newArchEnabled: false

"@shopify/flash-list": "^1.7.2",

Gravacao.de.tela.de.04-01-2025.14.03.24.webm

Emulator: Pixel 3a - Android 14
Physical Device: Samsung Galaxy S23 FE - Android 14

@cortinico cortinico added Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. and removed Needs: Triage 🔍 labels Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: FlatList Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. Needs: Author Feedback
Projects
None yet
Development

No branches or pull requests

5 participants