From a3f9c9aced88460fd0da8c73fce2ca40c4985c2f Mon Sep 17 00:00:00 2001 From: karim gharbi <58739019+Mirak005@users.noreply.github.com> Date: Wed, 17 Feb 2021 18:16:43 +0100 Subject: [PATCH] Update index.js --- index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index e649836..ef80124 100644 --- a/index.js +++ b/index.js @@ -57,6 +57,13 @@ export default class SearchableDropDown extends Component { componentDidMount = () => { const listItems = this.props.items; const defaultIndex = this.props.defaultIndex; + //show the items on render , we dont need to focus on the input to display the items + if(this.props.showItemsOnRender === true ){ + this.setState({focus : true }) + } + + + if (defaultIndex && listItems.length > defaultIndex) { this.setState({ listItems, @@ -262,4 +269,4 @@ export default class SearchableDropDown extends Component { } } -} \ No newline at end of file +}