Various fixes

This commit is contained in:
Ilya Laktyushin
2024-03-04 17:52:17 +04:00
parent 79ac0a6c5f
commit be9463e80b
7 changed files with 47 additions and 13 deletions

View File

@@ -88,6 +88,7 @@ public final class TokenListTextField: Component {
public let tokens: [Token]
public let sideInset: CGFloat
public let deleteToken: (AnyHashable) -> Void
public let isFocusedUpdated: (Bool) -> Void
public init(
externalState: ExternalState,
@@ -96,7 +97,8 @@ public final class TokenListTextField: Component {
placeholder: String,
tokens: [Token],
sideInset: CGFloat,
deleteToken: @escaping (AnyHashable) -> Void
deleteToken: @escaping (AnyHashable) -> Void,
isFocusedUpdated: @escaping (Bool) -> Void = { _ in }
) {
self.externalState = externalState
self.context = context
@@ -105,6 +107,7 @@ public final class TokenListTextField: Component {
self.tokens = tokens
self.sideInset = sideInset
self.deleteToken = deleteToken
self.isFocusedUpdated = isFocusedUpdated
}
public static func ==(lhs: TokenListTextField, rhs: TokenListTextField) -> Bool {
@@ -191,6 +194,7 @@ public final class TokenListTextField: Component {
guard let self else {
return
}
self.component?.isFocusedUpdated(self.tokenListNode?.isFocused ?? false)
self.componentState?.updated(transition: Transition(animation: .curve(duration: 0.35, curve: .spring)))
}