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

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

Closed
AndrewJack opened this issue Sep 19, 2018 · 33 comments
Closed

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

AndrewJack opened this issue Sep 19, 2018 · 33 comments
Labels
Bug Impact: Regression Describes a behavior that used to work on a prior release, but stopped working recently. Resolution: PR Submitted A pull request with a fix has been provided. Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@AndrewJack
Copy link
Contributor

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

@kelset kelset added Impact: Regression Describes a behavior that used to work on a prior release, but stopped working recently. 🔶Lists labels Sep 19, 2018
@kelset kelset changed the title [Bug] [FlatList] ListEmptyComponent is rendered upside down, when using inverted flag ListEmptyComponent is rendered upside down, when using inverted flag Sep 19, 2018
@JosimarGomes

This comment has been minimized.

@scottmas
Copy link

scottmas commented Nov 19, 2018

@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..

kelset pushed a commit that referenced this issue Dec 12, 2018
…ag. (#21496)

Summary:
Fix ListEmptyComponent is rendered upside down when using inverted flag.

Fixes #21196
Pull Request resolved: #21496

Differential Revision: D13334437

Pulled By: hramos

fbshipit-source-id: b34a9a0a153862d3d5dbe410ab0a6c66a8cfcffd
@hramos
Copy link
Contributor

hramos commented Dec 13, 2018

@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.

@kelset
Copy link
Collaborator

kelset commented Dec 14, 2018

@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)

@alexisbronchart
Copy link

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

@kelset
Copy link
Collaborator

kelset commented Dec 18, 2018

@alexisbronchart can you provide a repro?

@alexisbronchart
Copy link

@kelset https://github.com/alexisbronchart/invertedListTest

I committed everything in there. When I do a run-ios this is the result I get:
simulator screen shot - iphone 8 - 2018-12-18 at 12 51 42

@TylerNRobertson
Copy link

TylerNRobertson commented Dec 18, 2018

Why not just rotate your view 180deg? A simple:

styles = Stylesheet.create({
rotateView: {
transform: [{ rotate: '180deg' }]
}
})

would fix that problem at-least until it's changed in a react native release. I don't foresee any major react native updates before version 0.58 which isn't planned to release until the new year. Although keep an eye out on the version 0.57.x updates.

** Keep in mind this would not fix the issue with the ActivityIndicator appearing at the top instead of bottom when inverted flag is on, it would simple rotate only your empty list component**

@kelset
Copy link
Collaborator

kelset commented Dec 18, 2018

Reopening.

I wonder what is missing for it to work properly 🤔

Anyway yes, there won't be any release 'til next year, you can keep up on the react-native-releases repo.

@kelset kelset reopened this Dec 18, 2018
@alexisbronchart
Copy link

alexisbronchart commented Dec 18, 2018

Alright thanks! FYI for me it looks like 0.57.8 actually introduced the bug. If I revert to 0.57.7 everything is fine.

@eMerzh
Copy link

eMerzh commented Dec 18, 2018

and to add my 2c here : i've tested with @alexisbronchart 's repo and just undoing 30c2fb8 in node_modules and it work as expected

@alexisbronchart
Copy link

alexisbronchart commented Mar 20, 2019

Looks like this has been reintroduced in 0.59.0 (also in 0.59.1).

updated repro : https://github.com/alexisbronchart/invertedListTest

@kelset
Copy link
Collaborator

kelset commented Mar 20, 2019

Hey @alexisbronchart thanks for letting me know - could it be that the revert didn't happen on the 0.59 branch? Or it's something else causing it? 🤔

@kelset
Copy link
Collaborator

kelset commented Mar 28, 2019

ok looks like thanks to @michalchudziak we got a new fix for that :)

kelset pushed a commit that referenced this issue Mar 29, 2019
…zedList when it's inverted (#24167)

Summary:
Fixes #23453
Fixes #21196

Basically, changes made in #21496 currently breaks behavior of `<VirtualizedList />`  and any components that are based on it (`<SectionList />, <FlatList />`). This PR solves both issues listed above.

Visual confirmation of the resolved issue:

**Vertical, not inverted, not empty**
![image](https://user-images.githubusercontent.com/7837457/55076839-b005d700-5096-11e9-91de-090934cb0129.png)

**Vertical, not inverted, empty**
![image](https://user-images.githubusercontent.com/7837457/55076971-fb1fea00-5096-11e9-8d73-5a2d86275da8.png)

**Vertical, inverted, not empty**
![image](https://user-images.githubusercontent.com/7837457/55077042-23a7e400-5097-11e9-911f-9dad4d48a578.png)

**Vertical, inverted, empty**
![image](https://user-images.githubusercontent.com/7837457/55079957-87351000-509d-11e9-8f1c-b7134f1f43f9.png)

**Horizontal, not inverted, not empty**
![image](https://user-images.githubusercontent.com/7837457/55077118-44703980-5097-11e9-94e9-e33d4af436ee.png)

**Horizontal, not inverted, empty**
![image](https://user-images.githubusercontent.com/7837457/55077150-52be5580-5097-11e9-9d43-7cb4e983167e.png)

**Horizontal, inverted, not empty**
![image](https://user-images.githubusercontent.com/7837457/55077183-623d9e80-5097-11e9-9e8a-1b2468c7b3a9.png)

**Horizontal, inverted, empty**
![image](https://user-images.githubusercontent.com/7837457/55080033-af247380-509d-11e9-90ae-1ff656d46dd1.png)

[General] [Fixed] - Fixed VirtualizedList, SectionList and FlatList behavior on rendering list headers with inverted prop and zero items
Pull Request resolved: #24167

Differential Revision: D14642345

Pulled By: cpojer

fbshipit-source-id: b530bbbd57f60e53a976ac5db272ea4b2d2b3e99
@pedrobertao
Copy link

pedrobertao commented Jun 28, 2019

This is happening to
"react-native": "0.59.8"

System:
React Native Environment Info:
System:
OS: macOS 10.14.5
CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
Memory: 191.00 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 8.10.0 - ~/.nvm/versions/node/v8.10.0/bin/node
Yarn: 1.16.0 - /usr/local/bin/yarn
npm: 5.6.0 - ~/.nvm/versions/node/v8.10.0/bin/npm
SDKs:
iOS SDK:
Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
Android SDK:
API Levels: 27, 28, 29
Build Tools: 27.0.3, 28.0.3, 29.0.0
System Images: android-28 | Google APIs Intel x86 Atom
IDEs:
Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.3 => 16.8.3
react-native: 0.59.8 => 0.59.8
npmGlobalPackages:
react-native-cli: 2.0.1

@mjmasn
Copy link
Contributor

mjmasn commented Sep 2, 2019

@kelset it seems this issue is still present in 0.60.5 🤔

Screenshot from 2019-09-02 11-46-46

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: 1.36 GB / 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.4 AI-183.6156.11.34.5522156
  npmPackages:
    react: 16.8.6 => 16.8.6 
    react-native: ^0.60.5 => 0.60.5 
  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

@mjmasn
Copy link
Contributor

mjmasn commented Sep 2, 2019

cc @michalchudziak

@mjmasn
Copy link
Contributor

mjmasn commented Sep 2, 2019

Workaround if anyone is interested, just apply this style to your list empty component:

transform: [{scaleY: -1}]

@partriv
Copy link

partriv commented Sep 29, 2019

seems to be happening to me in RN 0.59.9

@kelset
Copy link
Collaborator

kelset commented Sep 30, 2019

Has anyone tried with 61 yet?

@mjmasn
Copy link
Contributor

mjmasn commented Sep 30, 2019

@kelset in the sense that my scaleY: -1 workaround is still working in 61, I assume this is still an issue in 61.

I can make a new repro repo if necessary though :)

@kelset
Copy link
Collaborator

kelset commented Sep 30, 2019

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

@kelset kelset reopened this Sep 30, 2019
@mjmasn
Copy link
Contributor

mjmasn commented Sep 30, 2019

@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

@zbettenbuk
Copy link

zbettenbuk commented Nov 21, 2019

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.

@zbettenbuk
Copy link

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

@mast
Copy link

mast commented Dec 4, 2020

Still an issue with 63.3

@raajnadar
Copy link

Still an issue with 0.64

@jedsada-jed
Copy link

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

image

@shivjon
Copy link

shivjon commented May 10, 2021

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}
/>

@minhna
Copy link

minhna commented Sep 15, 2021

write condition in inverted
@shivjon 👍

@github-actions
Copy link

github-actions bot commented Mar 4, 2023

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.

@github-actions github-actions bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Mar 4, 2023
@github-actions
Copy link

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

@facebook facebook locked as resolved and limited conversation to collaborators Mar 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Impact: Regression Describes a behavior that used to work on a prior release, but stopped working recently. Resolution: PR Submitted A pull request with a fix has been provided. Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet