Post

Replies

Boosts

Views

Activity

Duplicated title in swiftui in NavigationView and bug with navigation buttons
Made code for example. If you make an incomplete swipe to the previous view, then in case of scrolling, the text of the editor starts to be duplicated with the title. I checked it even without @Environment, but through isActive, which was transmitted, but still this bug. Also, with an incomplete swipe, the buttons stop working. Could someone know the complete NavigationView tutorial to avoid some bugs? I need the title not to jump and the buttons are fine. struct View1: View { var body: some View { NavigationView { ZStack { Color.red NavigationLink("View 2", destination: View2()) } .navigationBarTitle("Back").navigationBarHidden(true).animation(.default) } } } struct View2: View { @State private var texti: String = "" @Environment(\.presentationMode) var presentationMode var body: some View { ZStack { VStack { TextEditor(text: $texti) .padding().onReceive(texti.publisher.collect()) { self.texti = String($0.prefix(2000))} } } .navigationBarTitle("Your Title") .navigationBarItems(trailing: HStack { Button(action:{}) { Text("Ed").foregroundColor(Color(#colorLiteral(red: 0.3647058824, green: 0.6901960784, blue: 0.4588235294, alpha: 1))) }; Button(action: {}) { Text("S").foregroundColor(Color(#colorLiteral(red: 0.3647058824, green: 0.6901960784, blue: 0.4588235294, alpha: 1))) }}) } }
0
0
859
Mar ’21
If navigationBarTitleDisplayMode?
How to set if in swiftui? I want the title to be automatic, but with .large and .inline certain actions were taken.
Replies
1
Boosts
0
Views
558
Activity
Apr ’21
Duplicated title in swiftui in NavigationView and bug with navigation buttons
Made code for example. If you make an incomplete swipe to the previous view, then in case of scrolling, the text of the editor starts to be duplicated with the title. I checked it even without @Environment, but through isActive, which was transmitted, but still this bug. Also, with an incomplete swipe, the buttons stop working. Could someone know the complete NavigationView tutorial to avoid some bugs? I need the title not to jump and the buttons are fine. struct View1: View { var body: some View { NavigationView { ZStack { Color.red NavigationLink("View 2", destination: View2()) } .navigationBarTitle("Back").navigationBarHidden(true).animation(.default) } } } struct View2: View { @State private var texti: String = "" @Environment(\.presentationMode) var presentationMode var body: some View { ZStack { VStack { TextEditor(text: $texti) .padding().onReceive(texti.publisher.collect()) { self.texti = String($0.prefix(2000))} } } .navigationBarTitle("Your Title") .navigationBarItems(trailing: HStack { Button(action:{}) { Text("Ed").foregroundColor(Color(#colorLiteral(red: 0.3647058824, green: 0.6901960784, blue: 0.4588235294, alpha: 1))) }; Button(action: {}) { Text("S").foregroundColor(Color(#colorLiteral(red: 0.3647058824, green: 0.6901960784, blue: 0.4588235294, alpha: 1))) }}) } }
Replies
0
Boosts
0
Views
859
Activity
Mar ’21