@@ -16,7 +16,7 @@ public struct AcceptView: View {
1616 @Environment ( \. dismiss) var dismiss
1717 @State private var isApplyBottomSheetPresented = false
1818 @State private var selectedOption : ApplicationType = . outgoing
19- @State private var selectedFloor : Int = 1
19+ @State private var selectedFloor : Int = 3
2020 @State private var showApprovePopup = false
2121 @State private var showRejectPopup = false
2222 let store : StoreOf < AcceptReducer >
@@ -64,31 +64,44 @@ public struct AcceptView: View {
6464 . padding ( . horizontal, 24 )
6565
6666 if selectedOption == . classroomMove {
67- ScrollView ( . horizontal, showsIndicators: false ) {
68- HStack ( spacing: 8 ) {
69- ForEach ( 1 ... 5 , id: \. self) { floor in
70- Button {
71- selectedFloor = floor
72- viewStore. send ( . fetchApplicationsByFloor( floor: floor) )
73- } label: {
74- Text ( " \( floor) 층 " )
75- . pickText (
76- type: . body1,
77- textColor: selectedFloor == floor ? . Primary. primary500 : . Gray. gray600
78- )
79- . frame ( width: 114 , height: 32 )
80- . background (
81- selectedFloor == floor
82- ? Color . Primary. primary50
83- : Color . clear
84- )
85- . cornerRadius ( 8 )
67+ ScrollViewReader { proxy in
68+ ScrollView ( . horizontal, showsIndicators: false ) {
69+ HStack ( spacing: 8 ) {
70+ ForEach ( [ 1 , 2 , 3 , 4 , 5 ] , id: \. self) { floor in
71+ Button {
72+ selectedFloor = floor
73+ viewStore. send ( . fetchApplicationsByFloor( floor: floor) )
74+ } label: {
75+ Text ( " \( floor) 층 " )
76+ . pickText (
77+ type: . body1,
78+ textColor: selectedFloor == floor ? . Primary. primary500 : . Gray. gray600
79+ )
80+ . frame ( width: 114 , height: 32 )
81+ . background (
82+ selectedFloor == floor
83+ ? Color . Primary. primary50
84+ : Color . clear
85+ )
86+ . cornerRadius ( 8 )
87+ }
88+ . id ( floor)
8689 }
8790 }
91+ . padding ( . horizontal, 24 )
8892 }
89- . padding ( . horizontal, 24 )
93+ . onAppear {
94+ proxy. scrollTo ( 3 , anchor: . center)
95+ }
96+ . onChange ( of: selectedOption) { newValue in
97+ if newValue == . classroomMove {
98+ DispatchQueue . main. asyncAfter ( deadline: . now( ) + 0.1 ) {
99+ proxy. scrollTo ( 3 , anchor: . center)
100+ }
101+ }
102+ }
103+ . padding ( . top, 16 )
90104 }
91- . padding ( . top, 16 )
92105 }
93106
94107 HStack ( spacing: 0 ) {
0 commit comments