Last active
June 10, 2018 07:48
-
-
Save tonyvu2014/7d25911d72efa945f6e2a6f295e77674 to your computer and use it in GitHub Desktop.
AsyncStorage
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
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