merging pull request

This commit is contained in:
andrelandgraf 2019-08-21 15:41:23 +02:00
parent 9f69dc86ee
commit 5489910f2e
3 changed files with 6 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{
"name": "react-datalist-input",
"version": "1.2.8",
"version": "1.2.9",
"description": "This package provides a react component as follows: an input field with a drop down menu to pick a possible option based on the current input.",
"main": "./lib/DataListInput.js",
"license": "MIT",

View File

@ -34,6 +34,10 @@ function App() {
<DataListInput
items={data}
onSelect={i => setItem( i )}
placeholder="Select a ingredient"
clearInputOnSelect={false}
suppressReselect={false}
initialValue={item ? item.label : ''}
/>
</div>
</div>

View File

@ -252,7 +252,7 @@ class DataListInput extends React.Component {
<strong>
{ item.label.substr( indexOfMatch, currentInput.length ) }
</strong>
{ item.label.substr( currentInput.length, item.label.length ) }
{ item.label.substr( indexOfMatch + currentInput.length, item.label.length ) }
</React.Fragment>
);