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

Inverted Flatlist not working when scrolled #44151

Open
WoLewicki opened this issue Apr 18, 2024 · 5 comments
Open

Inverted Flatlist not working when scrolled #44151

WoLewicki opened this issue Apr 18, 2024 · 5 comments
Labels
Component: FlatList Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. p: Software Mansion Partner: Software Mansion Partner Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules)

Comments

@WoLewicki
Copy link
Contributor

WoLewicki commented Apr 18, 2024

Description

On new arch, when FlatList is inverted, after scrolling the elements don't fire their onPress since the information about their position must be calculated wrongly. There is probably a bug with this method:

return {-contentOffset.x, -contentOffset.y + stateData.scrollAwayPaddingTop};
when we invert the FlatList.

Steps to reproduce

  1. Scroll
  2. See that the onPress is not fired.

React Native Version

0.73.6

Affected Platforms

Runtime - Android
Runtime - iOS

Areas

Fabric - The New Renderer

Output of npx react-native info

System:
  OS: macOS 14.3
  CPU: (12) arm64 Apple M3 Pro
  Memory: 83.02 MB / 18.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.10.0
    path: ~/.nvm/versions/node/v20.10.0/bin/node
  Yarn:
    version: 1.22.19
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.2.3
    path: ~/.nvm/versions/node/v20.10.0/bin/npm
  Watchman:
    version: 2023.11.27.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.14.3
    path: /Users/wojciechlewicki/.rvm/gems/ruby-3.2.1/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.4
      - iOS 17.4
      - macOS 14.4
      - tvOS 17.4
      - visionOS 1.1
      - watchOS 10.4
  Android SDK:
    API Levels:
      - "26"
      - "27"
      - "28"
      - "29"
      - "30"
      - "31"
      - "32"
      - "33"
      - "34"
    Build Tools:
      - 28.0.3
      - 29.0.2
      - 30.0.2
      - 30.0.3
      - 31.0.0
      - 32.0.0
      - 32.1.0
      - 33.0.0
      - 33.0.1
      - 34.0.0
    System Images:
      - android-28 | Google ARM64-V8a Play ARM 64 v8a
      - android-29 | Google Play ARM 64 v8a
      - android-31 | Google Play ARM 64 v8a
      - android-32 | Google APIs ARM 64 v8a
      - android-33 | Google Play ARM 64 v8a
      - android-34 | Google Play ARM 64 v8a
    Android NDK: 22.1.7171670
IDEs:
  Android Studio: 2023.2 AI-232.10300.40.2321.11567975
  Xcode:
    version: 15.3/15E204a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 18.0.2
    path: /opt/homebrew/opt/openjdk@18/bin/javac
  Ruby:
    version: 3.2.1
    path: /Users/wojciechlewicki/.rvm/rubies/ruby-3.2.1/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.6
    wanted: 0.73.6
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: Not found
  newArchEnabled: false

Stacktrace or Logs

None here

Reproducer

https://github.com/WoLewicki/reproducer-react-native/tree/%40wolewicki/flatlist-inverted

Screenshots and Videos

No response

@WoLewicki WoLewicki added Needs: Triage 🔍 Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules) labels Apr 18, 2024
@roryabraham
Copy link

@WoLewicki thanks for producing this minimal reproduction. Should we update the reproducer to use RN 0.74.0-rc.9 rather than 0.73.6 and see if it's still reproducible?

@roryabraham
Copy link

@cortinico
Copy link
Contributor

Thanks @WoLewicki and @roryabraham for providing a reproducer and verifying against 0.74.0

This is (sadly) as known issue. The root cause is that for inverted flatlist we use a transform which is sometimes causing problems with measurements on Fabric (resulting in missed clicks). I remember discussing this with a lot of folks (@sammy-SC @javache @kmagiera @tomekzaw et. al.)

We were already aware of this issue and it's higher up on our agenda to fix.
We'll update more on this issue as we have actionable next steps.

@cortinico cortinico added Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. and removed Needs: Triage 🔍 labels Apr 19, 2024
@WoLewicki
Copy link
Contributor Author

@kosmydel has just found a potential fix for the problem, he'll link the PR here when he makes one 🚀

@kosmydel
Copy link

Hey, here is a potential fix for this issue.

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. p: Software Mansion Partner: Software Mansion Partner Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules)
Projects
None yet
Development

No branches or pull requests

5 participants