Mijick / NavigationView

Navigation made simple (SwiftUI)
MIT License
238 stars 9 forks source link

A layout exception occurred while using TextEditor #35

Closed lutianlei closed 2 months ago

lutianlei commented 2 months ago

Example (ChatView().push(with:.cubeRotation)) Symptom: When TextEditor is used in ChatView, the layout is displayed abnormally after the keyboard is ejected 1719393500231

FulcrumOne commented 2 months ago

Hey @lutianlei,

Could you isolate the code that is causing this problem and post it here so that I can take a look at it?

Thanks for your help!

lutianlei commented 2 months ago

import SwiftUI import MijickNavigationView

struct ChatView: NavigatableView {

var body: some View {
    GeometryReader { proxy in
        VStack(spacing: 0) {
            Spacer()
            Send(proxy: proxy)
        }
        .edgesIgnoringSafeArea(.bottom)
    }
}

}

fileprivate struct Send: View { let proxy: GeometryProxy @State private var text: String = ""

var body: some View {
    VStack(spacing: 0) {
        ZStack {
            Color.gray
            VStack {
                HStack(spacing: 12) {
                    TextEditor(text: $text)
                        .frame(height: 40)
                        .cornerRadius(4)
                }
                .frame(height: 56)
                .padding(.horizontal, 12)

                Spacer()
            }
        }
        .frame(height: proxy.safeAreaInsets.bottom + 56)
    }
}

}

execute:ChatView().push(with:.cubeRotation)

FulcrumOne commented 2 months ago

Hey @lutianlei,

I'll do my best to fix it tomorrow, but no promises as I'm still working on task #31.

Thanks for your report and have a nice day!

FulcrumOne commented 2 months ago

@lutianlei, to confirm - you mean the interface elements are thrown up too high when the keyboard is presented, right?

lutianlei commented 2 months ago

@FulcrumOne Using your Demo test, configuring the implementNavigationView display is wrong, not configured is right, please check, please see the screen recording

https://github.com/Mijick/NavigationView/assets/14904536/07e9f4ab-eccf-4da3-9669-c15a4b16d7a6

FulcrumOne commented 2 months ago

hey @lutianlei,

The problem should be solved in the main branch. Could you please check it and let me know? Thanks!