Created
February 10, 2017 15:50
-
-
Save mariodev12/b5d79bcf49c6c10b03aa4fbd7ddbcb1c to your computer and use it in GitHub Desktop.
This file contains 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
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