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

ListView doesn't work properly on iOS if state is initiated while screen not being currently displayed #14069

Closed
jcharlet opened this issue May 19, 2017 · 4 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@jcharlet
Copy link

Description

I display a list of items using a ListView in a screen called History.
The state of that screen can be changed in 3 cases, and all of them happen when the user is looking at another screen

  • when I start the app, I load the list of items on all my screens (using redux) and display the home screen
  • when I create an item or I remove an item in separate screens, the history is also updated

When I display the screen, I should see a horizontal list of my items. It works fine on Android. On iOS however, I see a blank screen, and if I touch/scroll the screen, the list of items suddenly appears at the right position.
gif showing the bug on iOS

mentioned on http://stackoverflow.com/questions/44022857/listview-not-displayed-unless-i-scroll-on-it

Reproduction Steps and Sample Code

install the react native repo below and run it ios simulator (used iphone6s). I reproduced it as well on iphone 5s and iphone 5c

https://github.com/jcharlet/react_native_listview_bug

Solution

I have not a clue of what should be done. If you could provide hints on where to investigate, it would be highly appreciated.

I tried unsuccessfully:

  • scroll to 0,0 when rendering the screen using ListView.scrollTo
  • to load rides again with redux when navigating to history screen
  • upgrade react and react native to last versions
  • generate a separate redux action for loading rides in history screen 'LR' (I otherwise use the same LOAD_RIDES action in hackDetails and History screens to update their states)

Additional Information

"react": "16.0.0-alpha.6",
"react-navigation": "1.0.0-beta.9",
"react-redux": "^5.0.3",

  • React Native version: "0.44.0"
  • Platform: iOS (works fine on Android)
  • Development Operating System: Linux Ubuntu 16.04 & MacOSX
  • Dev tools: Xcode updated this week, iOS SDK 10.3
@anttimo
Copy link
Contributor

anttimo commented May 22, 2017

Sounds like #1831 and can be worked around by adding removeClippedSubViews={false} to the ListView. It might cause some performance issues depending on large your list is https://facebook.github.io/react-native/docs/listview.html#removeclippedsubviews but that's what we have been using.

@jcharlet
Copy link
Author

Thanks @anttimo that was it!

@jcharlet
Copy link
Author

Duplicate to #1831

@anttimo
Copy link
Contributor

anttimo commented May 22, 2017

np. glad that I was able to help :)

@facebook facebook locked as resolved and limited conversation to collaborators May 24, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

3 participants