File tree Expand file tree Collapse file tree 1 file changed +22
-14
lines changed
Core/Sources/SuggestionWidget Expand file tree Collapse file tree 1 file changed +22
-14
lines changed Original file line number Diff line number Diff line change @@ -99,25 +99,33 @@ struct ChatTabBar: View {
9999 ) }
100100 ) { viewStore in
101101 HStack ( spacing: 0 ) {
102- ScrollView ( . horizontal) {
103- HStack ( spacing: 0 ) {
104- ForEach ( viewStore. state. tabInfo, id: \. id) { info in
105- ChatTabBarButton (
106- store: store,
107- info: info,
108- isSelected: info. id == viewStore. state. selectedTabId
109- )
110- . contextMenu {
111- if let tab = viewStore. state. tabs
112- . first ( where: { $0. id == info. id } )
113- {
114- tab. menu
102+ ScrollViewReader { proxy in
103+ ScrollView ( . horizontal) {
104+ HStack ( spacing: 0 ) {
105+ ForEach ( viewStore. state. tabInfo, id: \. id) { info in
106+ ChatTabBarButton (
107+ store: store,
108+ info: info,
109+ isSelected: info. id == viewStore. state. selectedTabId
110+ )
111+ . id ( info. id)
112+ . contextMenu {
113+ if let tab = viewStore. state. tabs
114+ . first ( where: { $0. id == info. id } )
115+ {
116+ tab. menu
117+ }
115118 }
116119 }
117120 }
118121 }
122+ . hideScrollIndicator ( )
123+ . onChange ( of: viewStore. selectedTabId) { id in
124+ withAnimation ( . easeInOut( duration: 0.2 ) ) {
125+ proxy. scrollTo ( id)
126+ }
127+ }
119128 }
120- . hideScrollIndicator ( )
121129
122130 Divider ( )
123131
You can’t perform that action at this time.
0 commit comments