File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ export default function App() {
100
100
const otherTags = allTags . slice ( 0 , - 1 ) ;
101
101
let newTag = allTags . slice ( - 1 ) [ 0 ] ;
102
102
// add new tag if it doesn't already exist
103
- if ( newTag . inputValue ) {
103
+ if ( newTag && newTag . inputValue ) {
104
104
newTag = createTag ( newTag . inputValue ) ;
105
105
allTags = [ ...otherTags , newTag ] ;
106
106
}
Original file line number Diff line number Diff line change @@ -26,12 +26,14 @@ export default function TagsInput(props) {
26
26
onChange = { props . onChange }
27
27
inputValue = { inputValue }
28
28
onInputChange = { ( e , newInputValue ) => {
29
- setInputValue ( newInputValue ) ;
29
+ setInputValue ( newInputValue . toLowerCase ( ) ) ;
30
30
} }
31
31
multiple
32
32
autoHighlight
33
33
filterSelectedOptions
34
34
freeSolo
35
+ clearOnBlur
36
+ openOnFocus
35
37
filterOptions = { ( options , params ) => {
36
38
const filtered = filter ( options , params ) ;
37
39
// Suggest the creation of a new value per...
@@ -44,7 +46,11 @@ export default function TagsInput(props) {
44
46
}
45
47
return filtered ;
46
48
} }
47
- options = { props . options }
49
+ options = { props . options . sort ( ( a , b ) => {
50
+ if ( a . label < b . label ) return - 1 ;
51
+ if ( a . label > b . label ) return 1 ;
52
+ return 0 ;
53
+ } ) }
48
54
getOptionLabel = { ( option ) => option . label }
49
55
renderOption = { ( option , { inputValue } ) => {
50
56
const matches = match ( option . label , inputValue ) ;
You can’t perform that action at this time.
0 commit comments