Skip to content

Commit

Permalink
Add isFocused property to RenameView TextField and set it to true onA…
Browse files Browse the repository at this point in the history
…ppear
  • Loading branch information
liamcharger committed May 2, 2024
1 parent 9ff57db commit 0baae7f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions InfiniLink/Core/Home/RenameView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@ import SwiftUI
struct RenameView: View {
@ObservedObject var bleManager = BLEManager.shared
@ObservedObject var deviceInfo = BLEDeviceInfo.shared

@Environment(\.colorScheme) var colorScheme
@Environment(\.presentationMode) var presentationMode

@FocusState var isFocused: Bool

@State private var changedName: String = BLEDeviceInfo.shared.deviceName

private var nameManager = DeviceNameManager()

var body: some View {
Expand Down Expand Up @@ -59,12 +64,16 @@ struct RenameView: View {
.padding()
.background(Material.regular)
.clipShape(Capsule())
.focused($isFocused)
Spacer()
}
.padding()
}
}
.navigationBarBackButtonHidden()
.onAppear {
isFocused = true
}
}
}

Expand Down

0 comments on commit 0baae7f

Please sign in to comment.