Tokamak
Tokamak copied to clipboard
GeometryReader extends after setting inner view size to it's provided value
Going further. If i place Text inside GeometryReader It won't adjust it's size. It is not multiline. and setting frame(maxWidth: proxy.size.width) base on Geometry reader will stretch my view in consecutive view updates increasing GeometryReader size till texts inside Text object will exhaust it's size.
@shial4 thanks for reporting the issue! Could you provide a code snippet for reproduction?
@MaxDesiatov sure. Will follow up on it and provide example in few days. Moving places right now. Have no way to pull out my computer. :/ Sorry for delay.
No pressure at all, whenever is more convenient for you! Good luck with the move 🙂
I think this will be enough
Make sure you do have someVeryLongString
equal to value of 1-2 pages A4
GeometryReader { proxy in
Text(someVeryLongString).frame(width: proxy.size.width)
}
Another example:
import TokamakDOM
struct TokamakApp: App {
var body: some Scene {
WindowGroup("Geometry jumps") {
ContentView()
}
}
}
// @main attribute is not supported in SwiftPM apps.
// See https://bugs.swift.org/browse/SR-12683 for more details.
TokamakApp.main()
struct ContentView: View {
var body: some View {
ScrollView(.vertical, showsIndicators: false) {
ZStack {
BodyView()
}
}
}
}
struct HeaderView: View {
var body: some View {
Text("Header")
}
}
struct BodyView: View {
var body: some View {
VStack {
HeaderView(coordinator: coordinator)
GeometryReader { proxy in
Color.green
.frame(height: proxy.size.height - 200)
}
FooterView()
}
}
}
struct FooterView: View {
var body: some View {
Text("Footer")
}
}