We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When a shape (say a RoundedRectangle()) is added to the background modifier, the view fills the entire vertical height of the screen.
struct ContentView: View { var body: some View { Text("Hello, world!") .background(RoundedRectangle(cornerRadius: 10.0).fill(Color.red)) } }
Expected behavior
On iOS the background modifier does not change the view size, so I expected the size to remain the size of Text.
Text
Screenshots Attached
Workaround
In this particular example, the following code can be used to work around the issue:
Text("Hello, world!") .background(Color.red) .cornerRadius(10)
NOTE: This issue was previously described along with many other issues in issue #336. I wanted to provide a contrite example.
The text was updated successfully, but these errors were encountered:
Just dumping this here until I have time to open a PR, but this CSS should be able to fix both background and overlay layouts:
background
overlay
.zstack { display: inline-grid; grid-template-columns: auto auto; } .foreground { grid-area: a; } .background { /* The interesting part */ width: 0; min-width: 100%; height: 0; min-height: 100%; grid-area: a; overflow: hidden; background-color: red; }
It wouldn't actually apply to ZStack, just the background and overlay layouts.
ZStack
Sorry, something went wrong.
MaxDesiatov
Successfully merging a pull request may close this issue.
When a shape (say a RoundedRectangle()) is added to the background modifier, the view fills the entire vertical height of the screen.
Expected behavior
On iOS the background modifier does not change the view size, so I expected the size to remain the size of
Text
.Screenshots
Attached
Workaround
In this particular example, the following code can be used to work around the issue:
NOTE: This issue was previously described along with many other issues in issue #336. I wanted to provide a contrite example.
The text was updated successfully, but these errors were encountered: