-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Comments
@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? |
this is also reproducible in 0.74.0-rc.9: https://github.com/roryabraham/reproducer-react-native-scrollview-tap/tree/%40wolewicki/flatlist-inverted |
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. |
@kosmydel has just found a potential fix for the problem, he'll link the PR here when he makes one 🚀 |
Hey, here is a potential fix for this issue. |
Summary: This PR solves [this issue](#44151). Inverted FlatList doesn't work (elements cannot be clicked) when the list is scrolled. ## Changelog: <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [GENERAL] [FIXED] - Fix clicking items on the inverted FlatList on the new architecture Pull Request resolved: #44168 Test Plan: # Steps 1. `buck2 install catalyst-ios` or `buck2 install catalyst-android` 2. Go to `RNTester Browser - Fabric` -> `FlatList` -> `Inverted` 3. Toggle inverted to `true` 4. Scroll to the top 5. Tap down and drag to either left or right 6. Expected is to have Red highlighted (which indicate Press Down) when dragged. ## iOS | Before | After | |-----------------------|----------------------| | https://pxl.cl/53vCW | https://pxl.cl/53vDq | ## Android | Before | After | |-----------------------|----------------------| | https://pxl.cl/53vFp | https://pxl.cl/53vFG | ## Reproducing steps from OSS 1. Use this reproducer: https://github.com/WoLewicki/reproducer-react-native/tree/%40wolewicki/flatlist-inverted 2. Apply changes from this PR & build the app. 3. Scroll a bit the list, so it changes the position. 4. The `onPress` should be fired when the button is clicked. 5. Do the following tests: 1. Add a `horizontal` prop to the FlatList - verify everything works. 2. Remove a `inverted` prop - verify everything works. 3. Remove a `inverted` prop and add a `horizontal` prop - verify everything works. 6. Test different combinations of transforms of the FlatList, example: ```javascript <FlatList inverted horizontal style={{ transform: [ {scaleY: -1}, {scaleY: -2}, {scaleY: -0.5}, {translateY: 20}, {translateY: -10}, {skewX: '10deg'}, {rotateX: '10deg'}, ], }} /> ``` <details> <summary>Reproducrer</summary> https://github.com/facebook/react-native/assets/104823336/28cfe607-43e8-4f80-bbfb-59085ae0f986 </details> <details> <summary>RN tester</summary> https://github.com/facebook/react-native/assets/104823336/e00cd488-d98f-4ece-9cab-b8a7212acb04 </details> Reviewed By: arushikesarwani94 Differential Revision: D56441112 Pulled By: realsoelynn fbshipit-source-id: 82c47f6bcc1f25cfbbd55aedf9652052bb86cf47
PR is merged. 3753b7a Thanks everyone for your contribution 🥳 |
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:react-native/packages/react-native/ReactCommon/react/renderer/components/scrollview/ScrollViewShadowNode.cpp
Line 69 in ddc9bd1
FlatList
.Steps to reproduce
React Native Version
0.73.6
Affected Platforms
Runtime - Android
Runtime - iOS
Areas
Fabric - The New Renderer
Output of
npx react-native info
Stacktrace or Logs
Reproducer
https://github.com/WoLewicki/reproducer-react-native/tree/%40wolewicki/flatlist-inverted
Screenshots and Videos
No response
The text was updated successfully, but these errors were encountered: