From 5b55c9d2e33025a5dfd789053e6904159f37610c Mon Sep 17 00:00:00 2001 From: Yu Sung Date: Mon, 28 Oct 2024 14:12:25 +0900 Subject: [PATCH] =?UTF-8?q?=EB=9D=BC=EC=9D=B4=EB=B8=8C=EB=B0=A9=20-=20?= =?UTF-8?q?=EB=A9=94=EB=89=B4=ED=8C=90=20=EC=82=AC=EC=9D=B4=EC=A6=88=20-?= =?UTF-8?q?=20=EB=86=92=EC=9D=B4=EA=B0=80=20500=EB=B3=B4=EB=8B=A4=20?= =?UTF-8?q?=EC=9E=91=EC=9C=BC=EB=A9=B4=20=EB=A9=94=EB=89=B4=EC=9D=98=20?= =?UTF-8?q?=EA=B8=B8=EC=9D=B4=EB=A7=8C=ED=81=BC=20=ED=91=9C=EC=8B=9C?= =?UTF-8?q?=EB=90=98=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95=20-=20?= =?UTF-8?q?=EC=B5=9C=EB=8C=80=20=EB=86=92=EC=9D=B4=20500?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/Live/Room/V2/LiveRoomViewV2.swift | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/SodaLive/Sources/Live/Room/V2/LiveRoomViewV2.swift b/SodaLive/Sources/Live/Room/V2/LiveRoomViewV2.swift index cd59726..7b38a03 100644 --- a/SodaLive/Sources/Live/Room/V2/LiveRoomViewV2.swift +++ b/SodaLive/Sources/Live/Room/V2/LiveRoomViewV2.swift @@ -15,6 +15,7 @@ struct LiveRoomViewV2: View { @StateObject var viewModel = LiveRoomViewModel() @State private var textHeight: CGFloat = .zero + @State private var menuTextHeight: CGFloat = .zero var body: some View { ZStack { @@ -341,11 +342,18 @@ struct LiveRoomViewV2: View { .foregroundColor(.white) .lineSpacing(4) } + .background(GeometryReader { geometry in + Color.clear.preference(key: TextViewHeightKey.self, value: geometry.size.height) + }) } .padding(8) .background(Color.gray33) .padding(.horizontal, 60) - .padding(.bottom, 120) + .frame(maxWidth: 350) + .frame(height: menuTextHeight > 500 ? 500 : menuTextHeight, alignment: .topLeading) + .onPreferenceChange(TextViewHeightKey.self) { value in + menuTextHeight = value + 15 + } } } } @@ -759,6 +767,13 @@ struct LiveRoomViewV2: View { value += nextValue() } } + + struct TextViewHeightKey: PreferenceKey { + static var defaultValue: CGFloat = .zero + static func reduce(value: inout CGFloat, nextValue: () -> CGFloat) { + value = nextValue() + } + } } struct LiveRoomViewV2_Previews: PreviewProvider {