I have a container with many children, so user can press play (for example) and the container start scrolling down increasing the verticalScrollPosition attribute. In this moment some new component can be inserted in the container. If the component is inserted in the end of my container everything goes fine, I can see the scrollbar increasing your size but he keep showing the same element that was showing before without and flick. But, if the new component is inserted in the first element of the container all other elements move down and I lost the element that I've seeing before. If when I insert a element on first index I increase the verticalScrollPosition to the new element's height but it isn't smooth. Is there any way to do it?
Thanks you all.
You would need to calculate the height of the new component and add or subtract from the value that you are setting for the verticalScrollPosition.
If you calcs are correct and do it right after the component is added, you should be able to get smooth scrolling still. You might need to call validateNow() so there is not a glitch right after you add since measure and layout happen on the next layout pass.
Yes, validateNow() and another small detail solve my problem. Thanks a lot!