react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Unable to maintain the visible area when prepending items in ListView

Open ayanchevski opened this issue 10 years ago • 13 comments

I am making an Android app (using react-native 0.18.1) that has a ListView full of items with different heights. I want to adjust the scroll position in a way that the currently visible area doesn't change when prepending items (the standart behaviour is just to maintain the scroll position and the visible area is pushed down). I tried to use ListView's onContentSizeChange and find the new scroll position by summing the old one and the difference between the new height and the old height. I am getting the heights with ListView.scrollProperties.contentLength. Then i use scrollResponderScrollWithoutAnimationTo(). The problem is that the transition that should be instant is in fact visible. The visible area is first pushed down and then returned back by the onContentSizeChange's logic.

P.S. I had also tried to make the calculations and scrolling in componentDidUpdate with requestAnimationFrame and using innerScrollView.measure() to find the new height, but the problem still appears.

ayanchevski avatar Jan 29 '16 09:01 ayanchevski

Hey ayanchevski, thanks for reporting this issue!

React Native, as you've probably heard, is getting really popular and truth is we're getting a bit overwhelmed by the activity surrounding it. There are just too many issues for us to manage properly.

  • If you don't know how to do something or something is not working as you expect but not sure it's a bug, please ask on StackOverflow with the tag react-native or for more real time interactions, ask on Discord in the #react-native channel.
  • If this is a feature request or a bug that you would like to be fixed, please report it on Product Pains. It has a ranking feature that lets us focus on the most important issues the community is experiencing.
  • We welcome clear issues and PRs that are ready for in-depth discussion. Please provide screenshots where appropriate and always mention the version of React Native you're using. Thank you for your contributions!

facebook-github-bot avatar Jan 29 '16 09:01 facebook-github-bot

+1

NikolaIliev avatar Jan 29 '16 09:01 NikolaIliev

+1

ramilushev avatar Jan 29 '16 11:01 ramilushev

+1

jgibbons avatar Jan 31 '16 02:01 jgibbons

+1

eysi09 avatar Feb 15 '16 12:02 eysi09

+1

LXQLab avatar Mar 19 '16 13:03 LXQLab

+1

tautvilas avatar Mar 30 '16 10:03 tautvilas

any solutions?

12d avatar Jul 13 '16 12:07 12d

We solved this by writing our own ListView on top of ScrollView. That's one approach you could consider.

ide avatar Jul 13 '16 18:07 ide

@ide So did I, but the result doesn't feel just as smooth as the native behaviour (not even close indeed ^^). Indeed, I have the same problem with a scrollview. Do you have any hint on how you proceeded ?

JeandeCampredon avatar Jul 22 '16 15:07 JeandeCampredon

@ayanchevski This is also a big issue for me. Looks like you already have a draft. I'd Happy to work/help/debug your code. Can you paste it in a Gist?

rturk avatar Jul 29 '16 20:07 rturk

@JeandeCampredon This is also a big issue for me. Looks like you already have a draft. I'd Happy to work/help/debug your code. Can you paste it in a Gist?

rturk avatar Jul 29 '16 20:07 rturk

Obviously a bunch of people want this. It's not quite clear to me what the next step is though - might be a total ListView overhaul. I suggest folks upvote https://productpains.com/post/react-native/fix-various-listview-issues to help get that prioritized. For now, I'm going to close this issue.

lacker avatar Oct 28 '16 20:10 lacker