Skip to content

Commit

Permalink
[iOS] support Button Shapes accessibility to tabItems
Browse files Browse the repository at this point in the history
  • Loading branch information
yuukiw00w committed Sep 10, 2024
1 parent 2daf030 commit 761bf72
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions app-ios/Sources/App/RootView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,30 @@ public struct RootView: View {
(tab: .about, icon: .icInfo),
(tab: .profileCard, icon: .icProfileCard),
]
HStack(spacing: 36) {
ForEach(items, id: \.tab) { item in
let isSelected = selection == item.tab
Button {
selection = item.tab
} label: {
Image(item.icon).renderingMode(.template).tint(isSelected ? nil : .white)

GeometryReader { geometry in
HStack(spacing: 0) {
ForEach(items, id: \.tab) { item in
let isSelected = selection == item.tab
Button {
selection = item.tab
} label: {
Image(item.icon).renderingMode(.template).tint(isSelected ? nil : .white)
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center)
.contentShape(Rectangle())
}
.frame(maxWidth: geometry.size.width / CGFloat(items.count), maxHeight: .infinity, alignment: .center)
}
}
.frame(width: geometry.size.width, height: geometry.size.height)
}
.padding(.vertical)
.padding(.horizontal, 24)
.frame(height: 64)
.frame(maxWidth: .infinity)
.padding(.horizontal, 12)
.background(.ultraThinMaterial, in: Capsule())
.overlay(Capsule().stroke(.gray, lineWidth: 1))
.environment(\.colorScheme, .dark)
.padding(.horizontal, 48)
}

@MainActor
Expand Down

0 comments on commit 761bf72

Please sign in to comment.