Sha256: d910923619373bf4a8e90bd7146028f46471dbcecb8bfd68819eafe56477ca8a
Contents?: true
Size: 920 Bytes
Versions: 86
Compression:
Stored size: 920 Bytes
Contents
import React, { Component } from 'react'; import { FormControl } from 'patternfly-react'; import { commonInputPropTypes } from '../helpers/commonPropTypes'; class TypeAheadInput extends Component { constructor(props) { super(props); this.handleKeyPress = this.handleKeyPress.bind(this); } componentDidMount() { if (this.ref) { this.ref.addEventListener('keydown', this.handleKeyPress); } } componentWillUnmount() { if (this.ref) { this.ref.removeEventListener('keydown', this.handleKeyPress); } } handleKeyPress(e) { this.props.onKeyPress(e); } render() { return ( <FormControl inputRef={(ref) => { this.ref = ref; }} onFocus={this.props.onInputFocus} type="text" {...this.props.passedProps} /> ); } } TypeAheadInput.propTypes = commonInputPropTypes; export default TypeAheadInput;
Version data entries
86 entries across 86 versions & 1 rubygems