import * as React from 'react'; import PropsTypes from './types'; interface State extends PropsTypes { show: boolean } export default class InputDropdown extends React.Component { constructor(props: PropsTypes, public state: State) { super(props); this.state = { show: this.props.show || false } } componentWillReceiveProps(props) { if (props.show !== this.props.show) { this.setState({ show: !this.state.show }) } } showHide() { this.setState({ show: !this.state.show }) } render() { const {children, show, size} = this.props; if (show) { return
{children}
} return null } }