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

Navigation bar shrinking behavior is broken #394

Open
2 tasks done
Uki19 opened this issue Jan 4, 2024 · 0 comments
Open
2 tasks done

Navigation bar shrinking behavior is broken #394

Uki19 opened this issue Jan 4, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Uki19
Copy link

Uki19 commented Jan 4, 2024

Description

I have a WebView (custom UIViewRepresentable component with WKWebView) within NavigationStack, and by default, scrolling animation of navigation bar (shrinking between large title and inline) is working fine. As soon as I add .introspect modifier on it, the shrinking animation doesn't work anymore.

If I use just a swiftUI ScrollView with ForEach, navbar shrinking works fine in both cases, so it might be something to do with .introspect on custom UIViewRepresentable, but I am not sure.

Video example without .introspect modifier:

Untitled.mp4

Video example with .introspect modifier:

Untitled.2.mp4

Checklist

Expected behavior

Navigation bar has default shrinking animation behavior

Actual behavior

Navigation bar is not shrinking/animating at all

Steps to reproduce

Here's simplest example of the issue, you can comment .introspect modifier to compare behavior

import SwiftUIIntrospect
import SwiftUI
import WebKit

struct WebView: UIViewRepresentable {

    func makeUIView(context: Context) -> WKWebView {
        let webview = WKWebView()
        let request = URLRequest(url: URL(string: "https://www.apple.com")!)
        webview.load(request)
        return webview
    }

    func updateUIView(_ uiView: WKWebView, context: Context) {
    }
}

struct ContentView: View {
    var body: some View {
        NavigationStack {
            WebView()
                .ignoresSafeArea(edges: [.bottom])
                .navigationTitle("Webview")
                .introspect(.navigationStack, on: .iOS(.v17), scope: .ancestor) { nav in
                    print(nav)
                }
        }
    }
}

#Preview {
    ContentView()
}

Version information

1.1.2

Destination operating system

No response

Xcode version information

No response

Swift Compiler version information

No response

@Uki19 Uki19 added the bug Something isn't working label Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant