Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SDK-805] Change error test behaviour #177

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Sources/Skyflow/elements/TextField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -403,11 +403,10 @@ extension TextField {
func updateErrorMessage() {

var isRequiredCheckFailed = false

let currentState = state.getState()
var currentState = state.getState()
if self.errorTriggered == false {
// Error styles
if (currentState["isEmpty"] as! Bool || self.actualValue.isEmpty) {
if (currentState["isEmpty"] as! Bool || self.actualValue.isEmpty || self.hasFocus) {
if currentState["isRequired"] as! Bool {
isRequiredCheckFailed = true
updateInputStyle(collectInput!.inputStyles.invalid)
Expand Down
1 change: 1 addition & 0 deletions Sources/Skyflow/elements/TextFieldValidationDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ internal class TextFieldValidationDelegate: NSObject, UITextFieldDelegate {
// label styles on focus
collectField.updateLabelStyle(collectField.collectInput!.labelStyles.focus)
collectField.onFocusHandler?((collectField.state as! StateforText).getStateForListener())
collectField.resetError()
}

/// Wrap native `UITextField` delegate method for `didEndEditing`.
Expand Down
1 change: 0 additions & 1 deletion Sources/Skyflow/elements/core/state/StateforText.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ internal class StateforText: State
result["validationError"] = validationError
result["isCustomRuleFailed"] = isCustomRuleFailed
result["isDefaultRuleFailed"] = isDefaultRuleFailed

return result
}

Expand Down