-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Fix a Tabs crash when change the TabControllers #98242
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switching the key like this is a little hacky. It often comes with other problems like state-loss in the children because they'll also be re-instantiated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the view metrics become larger, the scrolling will be divided into two stages, the second stage occurs in the layout stage, which will trigger a notification and then cause an exception.
In fact, we can ignore the scroll notification for the scrolling of this scene.
goderbauer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uber-nit: change this and below to _warpUnderwayCount += 1; for consistency with the rest of the file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: make showLast a (required) named parameter. This makes the code below a little more readable as you can see what parameter is set to true/false.
Fixes #97441
(#94339) If the
TabControllerchanged, we will call_pageController.jumpToPageto change the view position.But if the old pageView's metrics are small than the new controller index, it will abnormal.
My solution
If the controller changes, inflate a new
PageViewelement with the initial index.