File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -186,7 +186,8 @@ export default class Dropdown extends PureComponent {
186186 selected : - 1 ,
187187 modal : false ,
188188 value,
189- data : this . props . data
189+ data : this . props . data ,
190+ searchText,
190191 } ;
191192 }
192193
@@ -569,16 +570,15 @@ export default class Dropdown extends PureComponent {
569570 ) ;
570571 }
571572
572- searchFilterFunction ( text ) {
573+ searchFilterFunction ( searchText ) {
573574 let arrayholder = this . props . data
574575 const newData = arrayholder . filter ( item => {
575576 const itemData = `${ item . value . toUpperCase ( ) } ` ;
576- const textData = text . toUpperCase ( ) ;
577-
577+ const textData = searchText . toUpperCase ( ) ;
578578 return itemData . indexOf ( textData ) > - 1 ;
579579 } ) ;
580-
581- this . setState ( { data : newData } ) ;
580+ newData . push ( { value : searchText } ) ;
581+ this . setState ( { data : newData , searchText } ) ;
582582 } ;
583583
584584 renderItem ( { item, index } ) {
@@ -771,6 +771,10 @@ export default class Dropdown extends PureComponent {
771771 style = { styles . input }
772772 placeholder = { 'Search here' }
773773 placeholderTextColor = "#808080"
774+ clearButtonMode = "always"
775+ onSubmitEditing = { ( ) => {
776+ this . setState ( { value : this . state . searchText , modal : false } )
777+ } }
774778 onChangeText = { text => this . searchFilterFunction ( text ) }
775779 />
776780
You can’t perform that action at this time.
0 commit comments