Skip to content

Instantly share code, notes, and snippets.

@tonyvu2014
Last active June 10, 2018 07:48
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
AsyncStorage
AsyncStorage.getItem('preferences')
.then(value => {
if (value) {
console.log('PreferencesScreen - preferences:', value)
let terms = []
let prefs = value.split(',')
for (let i = 0; i < prefs.length; i++) {
terms.push({key: i, term: prefs[i]})
}
this.setState({terms: terms})
} else {
this.setState({terms: []})
}
}).done()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment