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

Scroll direction is inconsistent on inverted FlatList #1790

Closed
sonnyp opened this issue Oct 29, 2020 · 1 comment
Closed

Scroll direction is inconsistent on inverted FlatList #1790

sonnyp opened this issue Oct 29, 2020 · 1 comment

Comments

@sonnyp
Copy link

sonnyp commented Oct 29, 2020

The problem

<FlatList inverted={true}/> makes use of CSS transform: scaleY(-1); which produce unexpected and inconsistent scrolling behavior.

This specific issue has been reported to the Chromium team which marked it as WontFix https://bugs.chromium.org/p/chromium/issues/detail?id=1139881 and to https://webcompat.com/issues/60703

My suggestion would be to use flex-direction: column-inverted | row-inverted instead.
It wouldn't be as close to React Native as transform: scaleY(-1); but produce a better outcome for many/most? use cases.

It would also probably fix other strange behaviors reported in #1254 and #1579

An other option would be to document this issue and propose a solution in the documentation.

Regardless happy to send a PR.

How to reproduce

https://jsfiddle.net/6ebn7g3y/1/
https://bugs.chromium.org/p/chromium/issues/attachmentText?aid=472596

Expected behavior

Respects user preference on all platform.

Workaround:

<FlatList 
      inverted={false}
      listViewProps={{
        ref: (component) => {
          component?.setNativeProps({
            style: {'flex-direction': 'column-reverse'},
          });
        },
      }}
     ...
/>

Environment (include versions). Did this work in previous versions?

  • React Native for Web (version): 0.14.5
  • React (version): 17.0.1

Related: #1254 and #1579

@necolas
Copy link
Owner

necolas commented Oct 29, 2020

This is a duplicate of #1254

@necolas necolas closed this as completed Oct 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants