팬톡 TextField가 Focus 되었을 때 자판이 해당 영역을 가리는 버그 수정

This commit is contained in:
Yu Sung
2026-02-04 16:12:37 +09:00
parent 8d3aed41c2
commit 3456510eec
2 changed files with 319 additions and 304 deletions

View File

@@ -18,6 +18,7 @@ struct UserProfileFanTalkView: View {
let reportPopup: (Int) -> Void let reportPopup: (Int) -> Void
let deletePopup: (Int) -> Void let deletePopup: (Int) -> Void
let profilePopup: (Int) -> Void let profilePopup: (Int) -> Void
let fanTalkInputId: String
@Binding var isLoading: Bool @Binding var isLoading: Bool
@State private var cheersContent: String = "" @State private var cheersContent: String = ""
@@ -73,6 +74,7 @@ struct UserProfileFanTalkView: View {
cheersContent = "" cheersContent = ""
} }
} }
.id(fanTalkInputId)
.background(Color.gray23) .background(Color.gray23)
.cornerRadius(10) .cornerRadius(10)
.overlay( .overlay(

View File

@@ -14,6 +14,7 @@ struct UserProfileView: View {
@Environment(\.presentationMode) var presentationMode: Binding<PresentationMode> @Environment(\.presentationMode) var presentationMode: Binding<PresentationMode>
@StateObject var viewModel = UserProfileViewModel() @StateObject var viewModel = UserProfileViewModel()
@StateObject private var keyboardHandler = KeyboardHandler()
@State private var memberId: Int = 0 @State private var memberId: Int = 0
@State private var isShowMemberProfilePopup: Bool = false @State private var isShowMemberProfilePopup: Bool = false
@@ -23,10 +24,13 @@ struct UserProfileView: View {
@State private var maxCommunityPostHeight: CGFloat? = nil @State private var maxCommunityPostHeight: CGFloat? = nil
private let fanTalkInputId = "fanTalkInput"
var body: some View { var body: some View {
GeometryReader { proxy in GeometryReader { proxy in
BaseView(isLoading: $viewModel.isLoading) { BaseView(isLoading: $viewModel.isLoading) {
ZStack(alignment: .top) { ZStack(alignment: .top) {
ScrollViewReader { scrollProxy in
ScrollView(.vertical, showsIndicators: false) { ScrollView(.vertical, showsIndicators: false) {
LazyVStack(spacing: 48) { LazyVStack(spacing: 48) {
if let creatorProfile = viewModel.creatorProfile { if let creatorProfile = viewModel.creatorProfile {
@@ -357,10 +361,19 @@ struct UserProfileView: View {
self.memberId = $0 self.memberId = $0
self.isShowMemberProfilePopup = true self.isShowMemberProfilePopup = true
}, },
fanTalkInputId: fanTalkInputId,
isLoading: $viewModel.isLoading isLoading: $viewModel.isLoading
) )
} }
} }
.onChange(of: keyboardHandler.keyboardHeight) { height in
if height > 0 {
withAnimation(.easeOut(duration: 0.25)) {
scrollProxy.scrollTo(fanTalkInputId, anchor: .bottom)
}
}
}
}
} }
HStack(spacing: 14) { HStack(spacing: 14) {
@@ -556,7 +569,7 @@ struct UserProfileView: View {
Spacer() Spacer()
} }
} }
.ignoresSafeArea() .ignoresSafeArea(.container, edges: .all)
.sheet( .sheet(
isPresented: $viewModel.isShowShareView, isPresented: $viewModel.isShowShareView,
onDismiss: { viewModel.shareMessage = "" }, onDismiss: { viewModel.shareMessage = "" },