Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange behavior within NavigationViews #2

Open
tiltowait opened this issue Jun 18, 2021 · 2 comments
Open

Strange behavior within NavigationViews #2

tiltowait opened this issue Jun 18, 2021 · 2 comments

Comments

@tiltowait
Copy link

First off, I really like this package. Unfortunately, it behaves strangely with NavigationViews: content appears to "fly in" from off the screen. Demo code:

import SwiftUI
import CustomModalView

struct Tester: View {
  
  @State private var customModal = false
  
  var body: some View {
    NavigationView {
      List {
        Button("Click me") {
          customModal.toggle()
        }
      }
      .listStyle(InsetGroupedListStyle())
      .navigationTitle("Hi")
    }
    .modal(isPresented: $customModal) {
      Text("Hi")
        .padding()
    }
  }
}

Moving the view modifier somewhere else—such as attaching it to the Button fixes the "fly in" issue, but then the modal only displays over the button, not the full screen.

Tested on Xcode 12.5 and iOS 14.6.

@saul-melo
Copy link

I'm getting several [LayoutConstraints] Unable to simultaneously satisfy constraints. warnings when a modal displays a VStack > NavigationView > Form

@saul-melo
Copy link

Setting the NavigationView .navigationViewStyle(.stack) property got rid of the layout warnings I mentioned - perhaps this will work with your problem

https://developer.apple.com/forums/thread/673113

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

No branches or pull requests

2 participants