allowEmpty: PropTypes.bool,
defaultOpenValue: PropTypes.object,
currentSelectPanel: PropTypes.string,
+ focusOnOpen: PropTypes.bool,
onKeyDown: PropTypes.func,
};
};
}
+ componentDidMount() {
+ if (this.props.focusOnOpen) {
+ // Wait one frame for the panel to be positioned before focusing
+ const requestAnimationFrame = (window.requestAnimationFrame || window.setTimeout);
+ requestAnimationFrame(() => {
+ this.refs.input.focus();
+ this.refs.input.select();
+ });
+ }
+ }
+
componentWillReceiveProps(nextProps) {
const { value, format } = nextProps;
this.setState({