Post

Replies

Boosts

Views

Activity

Why tabView jumps one view back on orientation change?
I have a simple tabView, and when I change the orientation of my iPhone (from portrait to landscape) tab jumps one tab back. For example, if you are on page 2 and rotate your device, it goes to 1, but it should stay on page 2. Why this unwanted jump happens? Am I missing something? (The weird thing about this issue is when you turn the device back to portrait (from landscape), it doesn't jump.) struct ContentView: View {     @State var currentPage: Int = 1     var body: some View {             ZStack {                 TabView(selection: $currentPage) {                     Text("1").tag(0)                     Text("2").tag(1)                     Text("3").tag(2)                 } .indexViewStyle(PageIndexViewStyle(backgroundDisplayMode: .never)) .tabViewStyle(PageTabViewStyle())         }     } } I'm running the latest iOS and Xcode version.
6
0
3.6k
Nov ’20