0

When I use LongPressGesture in NavigationLink, the NavigationView cannot pull down after the link is full of screen because the LongPressGesture and NavigationView's pulling down have conflicts.

The code is as following:

VStack{
    HStack(alignment: .top) {
       NavigationLink(destination: Group
            { if self.isLongPressed { Destination2() } else { Destination1() } }, tag: index, selection: self.$currentTag
        ) {
            Text(self.lyrics[index])
        }


    }
}
.contentShape(Rectangle())  
.simultaneousGesture(LongPressGesture().onEnded { _ in })

Using two fingers to drag down NavigationView is also fine for me. But I do not know how to make it.

How to solve this bug and make pulling down NavigationView work? Thanks for any help.

Muz
  • 699
  • 1
  • 11
  • 25

1 Answers1

1

Try to add same TapGasture

}
.contentShape(Rectangle())  
.simultaneousGesture(TapGesture().onEnded {})
.simultaneousGesture(LongPressGesture().onEnded { _ in })
Asperi
  • 228,894
  • 20
  • 464
  • 690
  • I am sorry for that I did not tell the question clearly. The `TapGesture` has been used for go to destination 1 view and `LongPressGesture ` has been used for go to destination 2 view. So I think it will not work for me. – Muz Jun 14 '20 at 11:58