Skip to content

Commit 0863b38

Browse files
authored
Merge pull request #491 from Adamant-im/dev/trello.com/c/bfhjk1NL
[trello.com/c/bfhjk1NL] Fixed: Back button disappears from the toolbar
2 parents ed51f05 + 9a5a71c commit 0863b38

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

Adamant/Modules/PartnerQR/PartnerQRView.swift

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,37 @@ struct PartnerQRView: View {
1212
@ObservedObject var viewModel: PartnerQRViewModel
1313

1414
var body: some View {
15-
Form {
16-
infoSection()
17-
toggleSection()
18-
buttonSection()
19-
}
20-
.navigationBarTitleDisplayMode(.inline)
21-
.toolbar {
22-
ToolbarItem(placement: .principal) {
23-
toolbar()
15+
GeometryReader { geometry in
16+
Form {
17+
infoSection()
18+
toggleSection()
19+
buttonSection()
20+
}
21+
.navigationBarTitleDisplayMode(.inline)
22+
.toolbar {
23+
ToolbarItem(placement: .principal) {
24+
toolbar(maxWidth: geometry.size.width)
25+
}
2426
}
2527
}
2628
}
2729
}
2830

2931
private extension PartnerQRView {
30-
func toolbar() -> some View {
31-
Button(action: {
32-
viewModel.renameContact()
33-
}) {
32+
func toolbar(maxWidth: CGFloat) -> some View {
33+
Button(action: viewModel.renameContact) {
3434
HStack {
3535
if let uiImage = viewModel.partnerImage {
3636
Image(uiImage: uiImage)
3737
.resizable()
3838
.frame(squareSize: viewModel.partnerImageSize)
3939
}
40-
Text(viewModel.partnerName).font(.headline)
40+
Text(viewModel.partnerName)
41+
.font(.headline)
42+
.minimumScaleFactor(0.7)
43+
.lineLimit(1)
4144
}
45+
.frame(maxWidth: maxWidth - toolbarSpace, alignment: .center)
4246
}
4347
}
4448

@@ -101,3 +105,5 @@ private extension PartnerQRView {
101105
}
102106
}
103107
}
108+
109+
private let toolbarSpace: CGFloat = 150

0 commit comments

Comments
 (0)