fix edit profile
This commit is contained in:
parent
c7f51b30cd
commit
fa10e389cd
@ -25,6 +25,7 @@ struct EditProfileView: View {
|
|||||||
|
|
||||||
private let profileService = ProfileService()
|
private let profileService = ProfileService()
|
||||||
private let descriptionLimit = 1024
|
private let descriptionLimit = 1024
|
||||||
|
private let nameLimit = 32
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
ZStack {
|
ZStack {
|
||||||
@ -75,13 +76,18 @@ struct EditProfileView: View {
|
|||||||
|
|
||||||
Section(header: Text("Публичная информация")) {
|
Section(header: Text("Публичная информация")) {
|
||||||
TextField("Отображаемое имя", text: $displayName)
|
TextField("Отображаемое имя", text: $displayName)
|
||||||
|
.onChange(of: displayName) { newValue in
|
||||||
|
if newValue.count > nameLimit {
|
||||||
|
displayName = String(newValue.prefix(nameLimit))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
VStack(alignment: .leading, spacing: 5) {
|
VStack(alignment: .leading, spacing: 5) {
|
||||||
Text("Описание")
|
Text("Описание")
|
||||||
.font(.caption)
|
.font(.caption)
|
||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
TextEditor(text: $description)
|
TextEditor(text: $description)
|
||||||
.frame(height: 150)
|
.frame(height: 150)
|
||||||
.onChange(of: description) { newValue in
|
.onChange(of: description) { newValue in
|
||||||
if newValue.count > descriptionLimit {
|
if newValue.count > descriptionLimit {
|
||||||
description = String(newValue.prefix(descriptionLimit))
|
description = String(newValue.prefix(descriptionLimit))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user