Uh oh!
There was an error while loading. Please reload this page.
Fix inverted flat list - #44168
Conversation
facebook-github-bot
commented
Apr 19, 2024
Hi @kosmydel! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
cipolleschi
commented
Apr 19, 2024
/rebase - this comment rebase the PR on top of main automatically |
cipolleschi
left a comment
There was a problem hiding this comment.
The code looks good to me. I assume that inverting the list actually apply a transformation that is not applied to the content origin offset, right?
I wonder how many other instance of similar issues we have sprinkled around. 🤔
4e59e0e to
8fc31f6Comparekosmydel
commented
Apr 19, 2024
That's right. I still need to test it before opening it for review, as for now I tested it only in the @WoLewicki reproducer. |
There was a problem hiding this comment.
We tested this in a release build of the Expensify app and verified that it solves the problem for us 👍🏼
facebook-github-bot
commented
Apr 19, 2024
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
cipolleschi
commented
Apr 20, 2024
/rebase - this comment rebase the PR on top of main automatically |
8fc31f6 to
520ddb4Compare
cipolleschi
left a comment
There was a problem hiding this comment.
CI is red with an invalid operation. I suspect that this is usually a warning, but we have a "treat warnings as errors" build flag, so it fails in CI.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
kosmydel
commented
Apr 22, 2024
I've addressed the review and solved the mentioned issues |
Base commit: 6a3a305 |
I think this maybe should be adjusted for This might end up interacting with #43192 more broadly I think, since we need to after resolve transforms relative to view size. |
| return {-contentOffset.x, -contentOffset.y + stateData.scrollAwayPaddingTop}; | ||
| const auto& props = getConcreteProps(); | ||
| auto result = props.transform * Vector{-contentOffset.x, -contentOffset.y, 0, 1}; |
There was a problem hiding this comment.
| auto result = props.transform * Vector{-contentOffset.x, -contentOffset.y, 0, 1}; | |
| auto result = props.resolveTransform(layoutMetrics_) * Vector{-contentOffset.x, -contentOffset.y, 0, 1}; |
cc - @NickGerleman this should take the transformOrigin into consideration
intergalacticspacehighway
commented
Apr 22, 2024
I think as long as we use |
facebook-github-bot
commented
Apr 22, 2024
@NickGerleman has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
There was a problem hiding this comment.
I took a closer look at the function where we are doing this, and found a couple more potential issues:
- Making
getContentOriginOffset()return transformed offset breaks the contract assumed by DOM code - This is called by
getRelativeLayoutMetrics()which can be configured whether or not to use a transform. So we can't assume all callers there want a transform either
I.e. we're doing this transform at the wrong layer I think
kosmydel
commented
Apr 23, 2024
Hey, today I won't have time to investigate it.
Could you provide more details on where the change should be made? This would be helpful. |
NickGerleman
commented
Apr 23, 2024
How did we find this function as the original culprit? I.e. how do we call it for hit testing in the issue case? That would be a clue. |
WoLewicki
commented
Apr 23, 2024
We call it when adding offset for elements that are inside the |
NickGerleman
commented
Apr 23, 2024
@sammy-SC wrote this code it looks like, but I can see that We could maybe pass through policy for whether to include transform to this API, like some others. Because some code calling this (e.g. scroll offset) which rely on it not being transformed, but some other code calling it which already seems to try to apply transforms (and it sounds like one case, where we are forgetting to do this). |
kosmydel
commented
May 13, 2024
Hello, I made changes last week and applied a transform only where necessary. I would appreciate it if someone could review and confirm that these changes are what we want. Thank you. |
NickGerleman
commented
May 13, 2024
@realsoelynn you were digging into this, right? Could you take a look at current revision? |
realsoelynn
commented
May 30, 2024
Sorry about my late reply. Was busy with ReactConf and internal summit. I am still doing some more investigation. |
realsoelynn
commented
Jun 6, 2024
Like @NickGerleman mentioned below, Calculation for transform for ScrollViewNode need to be overridden specifically as done in the commit Code Suggestion Point ScrollViewShadowNode::getContentOriginOffset(
bool includeTransform) const {
auto stateData = getStateData();
auto contentOffset = stateData.contentOffset;
auto transform = includeTransform ? getTransform() : Transform::Identity();
auto result = transform * Vector{-contentOffset.x, -contentOffset.y, 0, 1};
return {result.x, result.y + stateData.scrollAwayPaddingTop};
}
|
realsoelynn
commented
Jun 10, 2024
@kosmydel Please address this code suggestion which is based on your original changes Point ScrollViewShadowNode::getContentOriginOffset(
bool includeTransform) const {
auto stateData = getStateData();
auto contentOffset = stateData.contentOffset;
auto transform = includeTransform ? getTransform() : Transform::Identity();
auto result = transform * Vector{-contentOffset.x, -contentOffset.y, 0, 1};
return {result.x, result.y + stateData.scrollAwayPaddingTop};
} |
41d97fb to
59fe663Comparefacebook-github-bot
commented
Jun 12, 2024
@realsoelynn has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
realsoelynn
commented
Jun 12, 2024
/rebase - this comment rebase the PR on top of main automatically |
realsoelynn
commented
Jun 12, 2024
/rebase |
realsoelynn
commented
Jun 12, 2024
@kosmydel Please help us rebase this PR so that we can do intake. Thanks in advance |
…sform or not (react#44822) Summary: Pull Request resolved: react#44822 Changelog: [Internal] This is to make `getContentOriginOffset` to have `includeTransform` information passed during Layout computation. Differential Revision: D58223380
7c4d603 to
0094773Comparefacebook-github-bot
commented
Jun 12, 2024
@realsoelynn has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
facebook-github-bot
commented
Jun 12, 2024
@realsoelynn merged this pull request in 3753b7a. |
This pull request was successfully merged by @kosmydel in 3753b7a. When will my fix make it into a release? | How to file a pick request? |
realsoelynn
commented
Jun 12, 2024
Thank you everyone for contributing to fix Inverted FlatList 🥳 |


Summary:
This PR solves this issue.
Inverted FlatList doesn't work (elements cannot be clicked) when the list is scrolled.
Changelog:
[GENERAL] [FIXED] - Fix clicking items on the inverted FlatList on the new architecture
Test Plan:
onPressshould be fired when the button is clicked.horizontalprop to the FlatList - verify everything works.invertedprop - verify everything works.invertedprop and add ahorizontalprop - verify everything works.Reproducrer
react-native-flat-list.mov
RN tester
android-rn-tester.mov