Skip to content

Commit f9936f5

Browse files
committed
fix(mobile): keep iPhone compose visible and tappable
1 parent d53873b commit f9936f5

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

‎apps/mobile/modules/t3-native-controls/ios/T3SidebarTabBarView.swift‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ private final class WorkspaceTabBar: UITabBar {
66

77
override func layoutSubviews() {
88
super.layoutSubviews()
9+
// Item identifiers aren't always present on UIKit's backing controls.
910
let row = tabButtons(in: self).reduce(CGRect.null) { $0.union(convert($1.bounds, from: $1)) }
10-
if !row.isNull { onContentLayout?(row) }
11+
let content = CGRect(x: 0, y: 0, width: bounds.width, height: max(0, bounds.height - safeAreaInsets.bottom))
12+
onContentLayout?(row.isNull ? content : row)
1113
}
1214

1315
override func safeAreaInsetsDidChange() {
@@ -17,9 +19,7 @@ private final class WorkspaceTabBar: UITabBar {
1719

1820
private func tabButtons(in view: UIView) -> [UIView] {
1921
view.subviews.filter { !$0.isHidden }.flatMap { subview in
20-
if subview is UIControl, subview.accessibilityIdentifier?.hasPrefix("workspace-tab-") == true {
21-
return [subview]
22-
}
22+
if subview is UIControl { return [subview] }
2323
return tabButtons(in: subview)
2424
}
2525
}
@@ -70,8 +70,7 @@ final class T3SidebarTabBarView: ExpoView, UITabBarDelegate {
7070
tabBarTrailing,
7171
tabBar.bottomAnchor.constraint(equalTo: bottomAnchor),
7272
])
73-
// UIKit's floating row changes with window geometry. Follow its laid-out items
74-
// instead of estimating their position from a second set of safe-area updates.
73+
// Follow the bar's layout so rotation and safe-area changes move both controls together.
7574
tabBar.onContentLayout = { [weak self] frame in self?.layoutCompose(alongside: frame) }
7675
composeButton.accessibilityLabel = "New chat"
7776
composeButton.addAction(UIAction { [weak self] _ in self?.onCompose() }, for: .touchUpInside)
@@ -123,8 +122,8 @@ final class T3SidebarTabBarView: ExpoView, UITabBarDelegate {
123122
private func layoutCompose(alongside frame: CGRect) {
124123
guard showsCompose, frame.height > 0 else { return }
125124
let row = convert(frame, from: tabBar)
126-
let size = row.height + 8
127-
composeButton.frame = CGRect(x: row.maxX + 16, y: row.midY - size / 2, width: size, height: size)
125+
let size = min(compact ? 64 : 76, max(44, row.height + 8))
126+
composeButton.frame = CGRect(x: min(row.maxX + 16, bounds.maxX - size), y: row.midY - size / 2, width: size, height: size)
128127
}
129128

130129
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {

0 commit comments

Comments
 (0)