-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Layout breaks view arrangements #1232
Comments
This is a serious problem. |
So the problem is that order of inserted view changes? The reason might be we don't check if the view is already child. Material/Sources/iOS/Layout/Layout.swift Lines 43 to 47 in 3677b26
|
Exactly, |
I submitted PR for this. Thank you for reporting 💪 |
Btw, you could workaround it by: parent.insertSubview(child, at: 0)
child.translatesAutoresizingMaskIntoConstraints = false
child.layout.edges() :) |
@mohpor please find your fix here and thank you for bringing this to our attention: https://github.com/CosmicMind/Material/releases/tag/3.1.2, thank you @OrkhanAlikhanov :) |
Hi,
In Material 2.x when we used Layout, we considered the child as free and the layout function would add it to the parent, and it is done through
addSubview
, there were cases that this was not the desired effect, for example when I add a blur view in my code, I want it to be at the bottom, so, first I would've inserted the child at 0, and then lay it out:Material 3 breaks this simple rule and adds the child to super view, without checking to see if the child already has a parent, and therefore breaks the arrangement the developer might have desired.
There is workaround for this, you can simply arrange the view afterwards, but now I have to look for every instance I've done it! This is a breaking change.
The text was updated successfully, but these errors were encountered: