Guest User

Untitled

a guest
Jan 18th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. componentWillMount() {
  2. AsyncStorage.getItem('language', (err, result) => {
  3. langCode = result;
  4. this.setState({
  5. currLang: result,
  6.  
  7. })
  8. });
  9.  
  10. }
  11.  
  12. onLangChange(value, index){
  13. Config.langCode = value;
  14. this.setState({ currLang: Config.langCode });
  15. AsyncStorage.setItem('language', value)
  16. console.log( 'here is your new lang ' + Config.langCode);
  17. }
  18.  
  19. render(){
  20. const {navigate} = this.props.navigation;
  21. const {goBack} = this.props.navigation
  22. const langText = Config.langText[this.state.currLang]; // Object that has text in current language.
  23.  
  24. return(
  25. <ScrollView style={styles.mainContainer}>
  26. <View style={styles.headerContainer}>
  27. <View style={styles.iconContainer}>
  28. <TouchableOpacity onPress={ () => goBack('') } >
  29. <Image source={Config.images.leftArrowIcon} style={styles.leftArrowIcon} />
  30. </TouchableOpacity>
Add Comment
Please, Sign In to add comment