Skip to content
This repository has been archived by the owner on Dec 27, 2020. It is now read-only.

NavigationLink's cell view not working inside grid #75

Closed
nobanhasan2 opened this issue Mar 12, 2020 · 13 comments
Closed

NavigationLink's cell view not working inside grid #75

nobanhasan2 opened this issue Mar 12, 2020 · 13 comments
Assignees

Comments

@nobanhasan2
Copy link

Image and text rendered in the grid view
Grid(viewModel.items){ item in NavigationLink(destination: BookDetail(displayData: item)){ SearchBookCell(displayData: item) } } .gridStyle( ModularGridStyle(columns: 2, rows: .fixed(200)) ).animation(.easeInOut)

@ay42
Copy link
Member

ay42 commented Mar 13, 2020

@nobanhasan2 do you have a NavigationView one level above grid?

var body: some View {
    NavigationView {
        Grid(...)
    }
}

@ay42
Copy link
Member

ay42 commented Mar 13, 2020

@nobanhasan2 I just added a working example with #79.
Closing this for now.

@ay42 ay42 closed this as completed Mar 13, 2020
@nobanhasan2
Copy link
Author

nobanhasan2 commented Mar 15, 2020

@ay42
Copy link
Member

ay42 commented Mar 15, 2020

@nobanhasan2 ok. I'm not sure what is not working for you there. Can you clarify?

@nobanhasan2
Copy link
Author

nobanhasan2 commented Mar 15, 2020

Here is the full code. I don't know why its overlay on my image and also in text.
`var body: some View {
ZStack {
Color(0xedeef0)
.edgesIgnoringSafeArea(.all)
NavigationView{
VStack {
SearchBookBar(text: $viewModel.searchText)

                                  Grid(viewModel.items){ item in
                                    NavigationLink(destination: BookDetail(displayData: item)){
                                        SearchBookCell(displayData: item)
                                        }
                                   }
                                  .gridStyle(
                                    ModularGridStyle(columns: 2, rows: .fixed(200))
                                       ).animation(.easeInOut)
                 
                      
                          }
        }
        
           }`

@ay42
Copy link
Member

ay42 commented Mar 15, 2020

@nobanhasan2 you mean where is the blue square should be an image rendered?

@ay42
Copy link
Member

ay42 commented Mar 15, 2020

@nobanhasan2 my guess is you are missing this line.

@nobanhasan2
Copy link
Author

@ay42 Yes.. i can solve the image render with that line but there Text is also rendered . Text has no function like renderingMode . How can i solve this?

@ay42
Copy link
Member

ay42 commented Mar 15, 2020

@nobanhasan2 for text color change .accentColor(...), .foregroundColor(...) ? Is that what you are trying to do just a color change?

@nobanhasan2
Copy link
Author

i didn't do any color change. Everything was fine without NavigationLink

@ay42
Copy link
Member

ay42 commented Mar 15, 2020

@nobanhasan2 navigation link makes it a button and it's rendered with system accent color

@nobanhasan2
Copy link
Author

Ohhh now i see. Thank you so much bro for your help ^_^

@ay42
Copy link
Member

ay42 commented Mar 15, 2020

@nobanhasan2 np

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants