Skip to content

Instantly share code, notes, and snippets.

@mariodev12
Created February 10, 2017 15:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mariodev12/b5d79bcf49c6c10b03aa4fbd7ddbcb1c to your computer and use it in GitHub Desktop.
Save mariodev12/b5d79bcf49c6c10b03aa4fbd7ddbcb1c to your computer and use it in GitHub Desktop.
filterSearch(text){
this.setState({text})
let newData = this.dataFilter(text, this.state.rawData);
this.setState({
dataSource: this.state.dataSource.cloneWithRows(newData),
isLoaded: true,
empty: false
})
}
dataFilter(text, data){
return data.filter(function(item){
const itemData = item.name.toUpperCase()
const textData = text.toUpperCase()
return itemData.indexOf(textData) > -1
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment