-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Fix content offset validation #15670
Conversation
This and 950c2b2 should be cherry picked into 0.48.0-rc |
@facebook-github-bot label Core Team Attention: @shergin Generated by 🚫 dangerJS |
@janicduplessis I think, the problem here is that this code can produce incorrect (overscrolled) layout at a first run/layout? |
@shergin Maybe if you specify contentOffset that is actually overscrolling but otherwise it should be fine. From what I understand the issue was with overscrolling when the scrollview changes frame (on sonething like screen rotation) and in that case it should work. |
@janicduplessis Don't get me wring, your solution is great indeed. But... you actually convinced me to dislike whole concept of having Now I am thinking that right plan can be:
What do you think? |
@shergin has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
@shergin - Is the plan to merge this and related fixes into 0.48 (prod), 0.49 (rc), or just keep it in master for 0.50? |
@wschurman You could advocate including this into RC if you want to. I have no strong point here. |
I posted in the 0.49-rc issue to get it cherry picked |
@janicduplessis Would it be possible for you to implement |
Content offset was broken because on initial render contentSize is {0,0} so any positive offset is lost. Also inset top/bottom and left/right were inversed 🙃, this led to bad initial scrolling offset when using contentInset. This fixes it by making sure contentSize is actually measured (not {0,0}. I guess it's possible that the content is ACTUALLY {0,0} but in that case I don't think it really matters).
Test plan
Tested that a scrollview has proper scroll position when specifying contentOffset. Also tested that it works well with contentInset.