Repository URL to install this package:
|
Version:
4.0.29 ▾
|
import { isFunction } from 'exotic'
import { TextBoxProps, TextBoxState, TextBoxComponent } from '../typings'
/**
* @extends TextBoxComponent @bound
*/
export function handleFocus(
event: Event,
props: TextBoxProps,
state: TextBoxState
) {
const { validationMethod, onFocus } = props
// @todo @fixme on the instance being passed...
if (isFunction(state.updateFocused)) {
state.updateFocused(event, this)
} else {
console.warn('state should implement updateFocused')
}
// this.state.validateInput(event, this)
if (isFunction(validationMethod)) {
validationMethod(event)
}
if (isFunction(onFocus)) {
onFocus(event)
}
// @todo this.state.valid().invalid()
// Removes error highlight
state.setIsValidInput(true)
}