Skip to content

Commit

Permalink
fix: fix scroll the tab when change index (#508)
Browse files Browse the repository at this point in the history
Co-authored-by: AcassioM <acassio.vilasboas@useblu.com.br>
  • Loading branch information
acassiovilasboas and AcassioM authored Oct 1, 2024
1 parent 88e4a20 commit e98aee5
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ extension OceanSwiftUI {

ForEach(0..<self.parameters.tabs.count, id: \.self) { index in
getTab(self.parameters.tabs[index], index: index)
.onChange(of: parameters.tabSelectedIndex) { _ in
.onChange(of: parameters.tabSelectedIndex) { newValue in
withAnimation {
scrollReader.scrollTo(parameters.tabSelectedIndex, anchor: .center)
scrollReader.scrollTo(newValue, anchor: .center)
}
}
.onAppear {
Expand Down

0 comments on commit e98aee5

Please sign in to comment.