Fix stretchy banner header in Edit profile
Put the views into ScrollView Fixed banner offset in Geometry reader Changelog-Fixed: Fixed stretchy banner header in Edit profile Signed-off-by: Swift Coder <scoder1747@gmail.com>
This commit is contained in:
@@ -9,6 +9,7 @@ import SwiftUI
|
||||
import Combine
|
||||
|
||||
let BANNER_HEIGHT: CGFloat = 150.0;
|
||||
fileprivate let Scroll_height: CGFloat = 700.0
|
||||
|
||||
struct EditMetadataView: View {
|
||||
let damus_state: DamusState
|
||||
@@ -79,11 +80,14 @@ struct EditMetadataView: View {
|
||||
func topSection(topLevelGeo: GeometryProxy) -> some View {
|
||||
ZStack(alignment: .top) {
|
||||
GeometryReader { geo in
|
||||
let offset = geo.frame(in: .global).minY
|
||||
EditBannerImageView(damus_state: damus_state, viewModel: bannerUploadObserver, callback: uploadedBanner(image_url:), safeAreaInsets: topLevelGeo.safeAreaInsets, banner_image: URL(string: banner))
|
||||
.aspectRatio(contentMode: .fill)
|
||||
.frame(width: geo.size.width, height: BANNER_HEIGHT)
|
||||
.frame(width: geo.size.width, height: offset > 0 ? BANNER_HEIGHT + offset : BANNER_HEIGHT)
|
||||
.clipped()
|
||||
}.frame(height: BANNER_HEIGHT)
|
||||
.offset(y: offset > 0 ? -offset : 0) // Pin the top
|
||||
}
|
||||
.frame(height: BANNER_HEIGHT)
|
||||
VStack(alignment: .leading) {
|
||||
let pfp_size: CGFloat = 90.0
|
||||
|
||||
@@ -129,7 +133,9 @@ struct EditMetadataView: View {
|
||||
|
||||
func content(topLevelGeo: GeometryProxy) -> some View {
|
||||
VStack(alignment: .leading) {
|
||||
ScrollView(showsIndicators: false) {
|
||||
self.topSection(topLevelGeo: topLevelGeo)
|
||||
|
||||
Form {
|
||||
Section(NSLocalizedString("Your Name", comment: "Label for Your Name section of user profile form.")) {
|
||||
let display_name_placeholder = "Satoshi Nakamoto"
|
||||
@@ -198,6 +204,8 @@ struct EditMetadataView: View {
|
||||
|
||||
|
||||
}
|
||||
.frame(height: Scroll_height)
|
||||
}
|
||||
|
||||
Button(action: {
|
||||
if !ln.isEmpty && !is_ln_valid(ln: ln) {
|
||||
|
||||
Reference in New Issue
Block a user