Textual content retains disappearing on:
- Display rotation.
- Focus Misplaced.
- Autofill Textual content entered (as proven in picture above).
I do not know what’s inflicting this behaviour, i’ve enroll and check in display, these screens are working positive.
ScrollView(showsIndicators: false) {
Picture(icon: .splash)
VStack {
HStack {
Textual content("OTP")
.titleText()
Spacer()
}
.padding(.prime, 50)
HStack {
Textual content("Please enter the OTP despatched to your cell quantity")
.padding(.prime, 1)
.multilineTextAlignment(.main)
.font(.customized(ubuntu: .common, fashion: .headline))
.foregroundColor(.customDarkGray)
Spacer()
}
ZStack(alignment: .middle) {
TextField("", textual content: $otpVM.verificationCode)
.background(Coloration.clear)
.body(maxWidth: .infinity, maxHeight: 70, alignment: .middle)
.font(Font.system(dimension: 30))
.accentColor(.clear)
.foregroundColor(.clear)
.multilineTextAlignment(.middle)
.keyboardType(.numberPad)
.onReceive(Simply($otpVM.verificationCode)) { _ in otpVM.limitText(6) }
.targeted($focusedField, equals: .area)
.activity {
DispatchQueue.most important.asyncAfter(deadline: .now() + 1.0)
{
self.focusedField = .area
print("Centered")
}
}
.padding()
HStack {
ForEach(0..<6) { index in
ZStack {
Textual content(otpVM.getPin(at: index))
.font(.customized(ubuntu: .common, fashion: .subheadline))
.foregroundColor(.customLightBlack)
.padding(.vertical, 22)
.padding(.horizontal, 18)
.overlay(
RoundedRectangle(cornerRadius: 6)
.strokeBorder(
Coloration.customLightBlack,
fashion: StrokeStyle(lineWidth: 0.6))
)
}
Spacer()
}
}
}
.padding(.prime, 30)
.padding(.backside, 50)
Button {
} label: {
Textual content(isRegistering ? "Register" : "Confirm Now")
}
}
}
Word that is simply part of code that’s copy pasted, this can simply provide help to perceive the error. I can present the entire information if required.