Tokamak icon indicating copy to clipboard operation
Tokamak copied to clipboard

Text does not center when background and frame modifier is used

Open DonChiaQE opened this issue 3 years ago • 1 comments

Describe the bug Text does not center when using the background and frame modifier.

Creating a background modifier with a coloured background does not show the text centered in the middle of the defined frame.

To Reproduce

struct ContentView: View {
    var body: some View {
        VStack {
            Text("1")
                .font(.system(size: 32))
                .frame(width: 80, height: 80, alignment: .center)
                .background(Color.yellow)
        }
    }
}

Expected behavior Text should center vertically and horizontally within the defined frame.

Screenshots

This is what happens currently, built in Tokamak.

Screenshot 2021-01-21 at 7 50 34 PM

And this is what is expected with SwiftUI, same code built in Swift Playground.

Screenshot 2021-01-21 at 7 49 39 PM

Desktop (please complete the following information):

  • OS: macOS 11.1
  • Browser: Chrome
  • Version of the browser: 87.0.4280.141 (arm64)
  • Version of Tokamak: 0.61

DonChiaQE avatar Jan 21 '21 11:01 DonChiaQE

Hi Can you assign me this issue

narendrajagne avatar Oct 04 '23 10:10 narendrajagne