Skip to content

Commit e996081

Browse files
etoledompinarol
andauthored
Avoid scrolling of frame on Avatar Picker (#752)
Co-authored-by: Pinar Olguc <[email protected]>
1 parent 3840a65 commit e996081

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

Sources/GravatarUI/SwiftUI/AvatarPicker/AvatarPickerView.swift

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,17 @@ struct AvatarPickerView<ImageEditor: ImageEditorView>: View {
131131
Button(Localized.dismissButtonTitle, role: .cancel) {}
132132
}
133133
}
134-
134+
// Display the frame outside of the scroll view around the content, but not around the loading or error states.
135+
.if(!model.isAvatarsLoading && !model.grid.isEmpty) { content in
136+
VStack(spacing: 0) {
137+
content
138+
.avatarPickerBorder(colorScheme: colorScheme)
139+
.padding(.horizontal, .DS.Padding.double)
140+
Spacer()
141+
.frame(height: .DS.Padding.double)
142+
.accumulateIntrinsicHeight()
143+
}
144+
}
135145
ToastContainerView(toastManager: model.toastManager)
136146
.padding(.horizontal, Constants.horizontalPadding * 2)
137147
}
@@ -287,7 +297,6 @@ struct AvatarPickerView<ImageEditor: ImageEditorView>: View {
287297
}
288298
)
289299
.padding(.horizontal, Constants.horizontalPadding)
290-
.padding(.vertical, .DS.Padding.medium)
291300
} else {
292301
HorizontalAvatarGrid(
293302
grid: model.grid,
@@ -308,7 +317,6 @@ struct AvatarPickerView<ImageEditor: ImageEditorView>: View {
308317
CTAButtonView(Localized.buttonUploadImage)
309318
}
310319
.padding(.horizontal, Constants.horizontalPadding)
311-
.padding(.bottom, .DS.Padding.medium)
312320
}
313321
}
314322

@@ -361,8 +369,6 @@ struct AvatarPickerView<ImageEditor: ImageEditorView>: View {
361369
header()
362370
avatarGrid()
363371
}
364-
.avatarPickerBorder(colorScheme: colorScheme)
365-
.padding(.horizontal, Constants.horizontalPadding)
366372
}
367373

368374
private func openProfileInSafari() {
@@ -509,7 +515,7 @@ enum AvatarPicker {
509515
]
510516
let selectedImageID = "5"
511517

512-
AvatarPickerView<NoCustomEditor>(
518+
return AvatarPickerView<NoCustomEditor>(
513519
avatarImageModels: avatarImageModels,
514520
selectedImageID: selectedImageID,
515521
profileModel: nil,

0 commit comments

Comments
 (0)