2013.2087 widget.newScrollView scrolls to top when inserting new items

a few builds ago I made an endless scrollview (like instagram - inserting new items to bottom when Reached Top Limit)

in this daily build; scroll goes to top 0,0 when inserting new items.

 -- If the scrollView has reached it's scroll limit if ( event.limitReached ) then if ( "up" == direction ) then print( "Reached Top Limit" ) loadNewItems() elseif ( "down" == direction ) then print( "Reached Bottom Limit" ) elseif ( "left" == direction ) then print( "Reached Left Limit" ) elseif ( "right" == direction ) then print( "Reached Right Limit" ) end end

I am loading images (network.download) and inserting to scrollview.

scroll jumps to top when inserting images

Thanks for the report @iPlayalot, we’ll take a look…

I cannot get anything but 0 from myScrollView:getContentPosition() - Docs say {x,y} should be returned. Build 2090

Hi @jack95,

I just tested the following in #2093, and it works for me.

[lua]

local sx,sy = scrollView:getContentPosition()

print(sx,sy)

[/lua]

Please check your code again and see if you can spot anything odd.

Brent

If you do single return assignment:

local single = myScrollView:getContentPosition()

it is always 0 unless you are in the listener or a touchlistener (I think)

if you capture the return as per the documented example:

local x,y = myScrollView:getContentPosition()

you get the proper values. I guess I’m just not used to functions returning multiple values but there is a return value inconsistency based on where you capture the data.

Hi @jack95,

Are you using a vertical-only scroll view (horizontal is locked)? If so, the 0 would make sense because the group can never go left or right, hence an x value of 0, which is the first parameter returned by the :getContentPosition() call.

I am loading images (network.download) and inserting to scrollview.

scroll jumps to top when inserting images

Thanks for the report @iPlayalot, we’ll take a look…

I cannot get anything but 0 from myScrollView:getContentPosition() - Docs say {x,y} should be returned. Build 2090

Hi @jack95,

I just tested the following in #2093, and it works for me.

[lua]

local sx,sy = scrollView:getContentPosition()

print(sx,sy)

[/lua]

Please check your code again and see if you can spot anything odd.

Brent

If you do single return assignment:

local single = myScrollView:getContentPosition()

it is always 0 unless you are in the listener or a touchlistener (I think)

if you capture the return as per the documented example:

local x,y = myScrollView:getContentPosition()

you get the proper values. I guess I’m just not used to functions returning multiple values but there is a return value inconsistency based on where you capture the data.

Hi @jack95,

Are you using a vertical-only scroll view (horizontal is locked)? If so, the 0 would make sense because the group can never go left or right, hence an x value of 0, which is the first parameter returned by the :getContentPosition() call.

Any news regarding this issue? Has it been fixed in the meenwhile? I’ve got the same problem (scrollview scrolls to top when inserting new items or even changing old ones).

I have also ran into this issue, loading more content to a scrollView will reset the scroll back to the top… Is there a plan for this fix?

I am having my users complain about this exact issue all the time… It’s quite a bad user/dev experience (loading more content to a scrollView will reset the scroll back to the top), I tried using tableView’s but the performance i get from it makes me fallback to use scrollView.

Corona, is there a fix coming for this? or is there a temporary decent fix? please!

Hi @eja,

This fix is currently being tested/approved and will presumably go out soon. Worst case, we release an open-source fix or something along those lines for users (like yourself) who need a more urgent fix. Your patience is appreciated on this.

Brent

Brent thank you so much for getting back to me so promptly, this would mean so much! Anything would help.

@eja

I am also trying to do something similar like yours, adding a lot of items into a scrollView/tableView while the user keeps scrolling down.

I am at the moment trying to choose using scrollView or tableView to do so.

When I see your earlier comment, it seems tableView performance is bad? How bad is it? So maybe I should just use scrollView directly? Any experience to share?

Thanks a lot.

Table view performance depends on the complexity of the onRowRender listener as the rows get continually recreated while scrolling. If you load large images or insert a lot of objects in the row then performance while scrolling will be bad.