Skip to content

Improvement for [Input] Component

Latest

Choose a tag to compare

@cloudle cloudle released this 19 Jul 11:35

Allow focus(), blur(), clear(), isFocused() function as Input's instance method.

import { Input } from 'react-universal-ui';

/*after get instance from "ref" (e.g. myInput)*/
<Input ref={(instance) => { this.myInput = instance; }} {...otherProps}/>

/*it's possible to call:
* - this.myInput.focus();
* - this.myInput.blur();
* - this.myInput.clear();
* - this.myInput.isFocused();
* like we could with ReactNative's [TextInput]
* */