Xcode 12.4
I am having trouble making ScrollView behave properly when in a NavigationView which has content that doesn't go beyond the bottom edge of the screen. Here is the concrete code example:
struct ContentView: View {
private let shortList = ["One", "Two", "Three"]
private let longList = ["One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight"]
var body: some View {
NavigationView {
ScrollView(showsIndicators: false) {
ForEach(shortList, id: \.self) { value in
Text(value)
.frame(width: 50, height: 50)
.background(Color.red)
.padding()
}
}
.navigationTitle("Testing")
}
}
}
When I use shortList in ForEach, on iPhone 12 Pro Max, the content doesn't go beyond the screen and creates the "flickering" (idk how to call it) effect on the Navigation Title. It sort of appears and dissapears quickly when the scroll goes back to the initial position.
gif
When I use longList in ForEach, on iPhone 12 Pro Max, the content goes beyond the screen so the scroll works as expected and the Navigation Title goes from large to inline as expected.
gif
Anyone has any ideas how to solve this? Thanks!