Created
April 9, 2019 09:50
-
-
Save ConnectedReasoning/e258793d10ea31d10a32db88dcd83977 to your computer and use it in GitHub Desktop.
handlers for autocomplete events
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
onAutocompleteFocus(){ | |
this.setState({defaultValue:'@'}); | |
this.setState({hideSuggestions:false}); | |
} | |
onAutocompleteTextChange(context_value){ | |
let suggestions = this.state.suggestions; | |
let newSuggestions = suggestions.filter(suggestion => { | |
return suggestion.startsWith(context_value); | |
}); | |
this.setState({context_value}); | |
this.setState({filteredSuggestions:newSuggestions}); | |
if(context_value !== '@inbox'){ | |
this.setState({hideSuggestions:false}); | |
} | |
} | |
onAutocompleteSelect(context_value){ | |
this.setState({context_value}); | |
this.setState({hideSuggestions:true}); | |
this.setState({defaultValue:context_value}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment