SwiftUI navigation issues in List

I have a list of items/cells where each item has many elements within it including a button. On tap of a cell, it navigates to screen say ViewA. And on tap of button within the cell, it goes to ViewB. However, on tap of the cell, instead of navigating to ViewA, it randomly navigates to ViewB even though the nav link isActive is disabled. Please suggest!

ViewA - List view

`List {
        ForEach(testData, id: \.self) { index in
           ZStack {
                NavigationLink("", destination:ViewA()).opacity(0)
                ViewAListItem()
           }.listRowBackground(Color.clear)
             .listRowSeparator(.hidden)
               .background(.clear)
             }
        }`

In another file,

 struct ViewAListItem: View {
    @State var test: Bool = false
    
    /// some other code
    ///
    ///
    /// 
    Button(action: {
        test = true
    }) {
        Text("Testing")
    }.background(
        NavigationLink("", destination: ViewB(), isActive: $test).opacity(0)
    )
}

Here even though the button is not tapped, variable test is true and navigating to ViewB on tap of cell which should launch ViewAListItem instead. Any issue with this?

SwiftUI navigation issues in List
 
 
Q