Skip to content

ListEmptyComponent is rendered upside down, when using inverted flag #21196

Closed

Description

@AndrewJack

Environment

 React Native Environment Info:
    System:
      OS: macOS High Sierra 10.13.6
      CPU: x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
      Memory: 227.11 MB / 16.00 GB
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 10.10.0 - /usr/local/bin/node
      Yarn: 1.9.4 - /usr/local/bin/yarn
      npm: 6.4.1 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 11.4, macOS 10.13, tvOS 11.4, watchOS 4.3
      Android SDK:
        Build Tools: 23.0.1, 23.0.2, 23.0.3, 24.0.0, 24.0.1, 24.0.2, 24.0.3, 25.0.0, 25.0.1, 25.0.2, 25.0.3, 26.0.0, 26.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.2
        API Levels: 23, 25, 26, 27, 28
    IDEs:
      Android Studio: 3.1 AI-173.4819257
      Xcode: 9.4.1/9F2000 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.5.0 => 16.5.0 
      react-native: 0.57.0 => 0.57.0 
    npmGlobalPackages:
      react-native-cli: 1.0.0

Description

The FlatList or SectionList ListEmptyComponent is rendered upside down, when using inverted flag

It was introduced by db061ea . I have reverted this change in our project, which works. cc @janicduplessis

To Reproduce

Create a FlatList with empty data, inverted={true}, and a ListEmptyComponent. Like below:

      <FlatList
        data={data}
        ListEmptyComponent={this.renderEmpty}
        style={styles.list}
        inverted
      />

Reproducible Demo

Example can be found here in InvertedListBug.js. or run the project and observe.
https://github.com/AndrewJack/react-native-basic

simulator screen shot - iphone 6 - 2018-09-19 at 11 56 20

Activity

  1. added
    Impact: RegressionDescribes a behavior that used to work on a prior release, but stopped working recently.
    on Sep 19, 2018
  2. changed the title [-][Bug] [FlatList] ListEmptyComponent is rendered upside down, when using inverted flag[/-] [+]ListEmptyComponent is rendered upside down, when using inverted flag[/+] on Sep 19, 2018
  3. JosimarGomes commented on Oct 4, 2018

    @JosimarGomes
  4. scottmas commented on Nov 19, 2018

    @scottmas

    @kelset @hramos Did this fix land in RN 0.57.5? Or are we going to need to wait for a future release? NPM shows 0.57.5 being released two days before #21117 was marked by the Facebook bot as being merged, so it seems likely not..

  5. added a commit that references this issue on Dec 5, 2018
    198eb02
  6. added a commit that references this issue on Dec 12, 2018
    30c2fb8
  7. hramos commented on Dec 13, 2018

    @hramos
    Contributor

    @scottmas it did not. You can easily tell if a fix is in a release by looking at the tags in the commit. b971c5b is only tagged with v0.58.0-rc.1 and v0.58.0-rc.0, so it's not in any of the 0.57 releases.

    If you have any other questions about the release process, you can take a look at https://github.com/react-native-community/react-native-releases where the status for each release is discussed in a dedicated GitHub issue.

  8. kelset commented on Dec 14, 2018

    @kelset
    Contributor

    @scottmas the fix landed in 0.57.8, you can find it in the changelog -> https://github.com/react-native-community/react-native-releases/blob/master/CHANGELOG.md#fixed

    (the reason why that tag doesn't appear as Hector explained is a mistery to me)

  9. alexisbronchart commented on Dec 18, 2018

    @alexisbronchart

    I'm running 0.57.8 and the issue is still happening.
    More importantly the list is not actually inverted as the refreshControl is shown at the top.
    simulator screen shot - iphone 8 - 2018-12-18 at 11 48 21

  10. kelset commented on Dec 18, 2018

    @kelset
    Contributor

    @alexisbronchart can you provide a repro?

  11. 27 remaining items

  12. kelset commented on Sep 30, 2019

    @kelset
    Contributor

    I see - yeah if you have time for a new repro it will be great. I'll reopen this in the meantime

  13. reopened this on Sep 30, 2019
  14. mjmasn commented on Sep 30, 2019

    @mjmasn
    Contributor

    @kelset 👍

    https://github.com/mjmasn/InvertedListEmptyComponentIssue

    react-native info output
    System:
        OS: Linux 4.15 Ubuntu 16.04.6 LTS (Xenial Xerus)
        CPU: (8) x64 Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz
        Memory: 148.70 MB / 15.54 GB
        Shell: 4.3.48 - /bin/bash
      Binaries:
        Node: 8.11.3 - ~/.nvm/versions/node/v8.11.3/bin/node
        Yarn: 1.17.3 - /usr/bin/yarn
        npm: 5.6.0 - ~/.nvm/versions/node/v8.11.3/bin/npm
        Watchman: 4.9.0 - /usr/local/bin/watchman
      SDKs:
        Android SDK:
          API Levels: 22, 24, 26, 27, 28, 29
          Build Tools: 23.0.1, 26.0.1, 26.0.2, 26.0.3, 27.0.0, 27.0.3, 28.0.2, 28.0.3, 29.0.0
          System Images: android-22 | Google APIs Intel x86 Atom_64, android-24 | Google APIs ARM 64 v8a, android-24 | Google APIs Intel x86 Atom, android-24 | Google APIs Intel x86 Atom_64, android-24 | Google Play Intel x86 Atom, android-25 | Google Play Intel x86 Atom, android-26 | Google APIs Intel x86 Atom, android-27 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom, android-29 | Google Play Intel x86 Atom_64
          Android NDK: 17.1.4828580
      IDEs:
        Android Studio: 3.5 AI-191.8026.42.35.5791312
      npmPackages:
        react: 16.9.0 => 16.9.0 
        react-native: ^0.61.1 => 0.61.1 
      npmGlobalPackages:
        create-react-native-app: 2.0.2
        react-native-cli: 2.0.1
        react-native-create-library: 3.1.2
        react-native-git-upgrade: 0.2.7
    
  15. zbettenbuk commented on Nov 21, 2019

    @zbettenbuk

    If you apply a CSS workaround and the bug gets fixed you may end up with the same issue if you forget to remove the workaround. Maybe it's just better to set inversed = { false } on the component when the data is empty and you'll be safe.

  16. zbettenbuk commented on Nov 21, 2019

    @zbettenbuk

    Btw it's still (or again?) happening in 61.3

  17. mast commented on Dec 4, 2020

    @mast

    Still an issue with 63.3

  18. raajnadar commented on Mar 27, 2021

    @raajnadar

    Still an issue with 0.64

  19. jedsada-jed commented on Apr 23, 2021

    @jedsada-jed

    Use view for wrap component work for me. (RN 0.64.0)

    image

  20. shivjon commented on May 10, 2021

    @shivjon

    write condition in inverted

    data.length !=0 ? true : false

    <FlatList
    inverted={data.length !=0 ? true :false }
    data={data}
    keyExtractor={(_, index) => String(index)}
    ListEmptyComponent={this.renderEmpty}
    style={styles.list}
    />

  21. minhna commented on Sep 15, 2021

    @minhna

    write condition in inverted
    @shivjon 👍

  22. github-actions commented on Mar 4, 2023

    @github-actions

    This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

  23. added
    StaleThere has been a lack of activity on this issue and it may be closed soon.
    on Mar 4, 2023
  24. github-actions commented on Mar 11, 2023

    @github-actions

    This issue was closed because it has been stalled for 7 days with no activity.

  25. locked as resolved and limited conversation to collaborators on Mar 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugImpact: RegressionDescribes a behavior that used to work on a prior release, but stopped working recently.Resolution: PR SubmittedA pull request with a fix has been provided.StaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions