configuration settings

#1

Hello guys

I built a module, to translate my app. The problem is that when I pick a lenguaje and go back to the previous screen, my menu buttons are not translated, but if I log out and log back in, everything is translated. A friend told me I should forceUpdate, but React native, encourage you to not do this. I was wondering if someone has any ideas

import React, { Component } from 'react';
import { View, Picker, Text } from 'react-native';
import { DangerZone } from 'expo';
import I18n from 'ex-react-native-i18n';

import Style from '../styles/styles';

export default class Configuration extends Component {

  static navigationOptions = ({ navigation }) => {
    return {
      title: navigation.getParam(I18n.t('languageSelection')) 
  };
}
    constructor() {
        super();
        this.styles = new Style();
    }

    state = { pickerSelection: null }

    changeLanguage(language){
      I18n.locale = language;
      return language
    }

    render() {
     return (
      <View>
        <Text style={this.styles.sheet.text}>{I18n.t('languageSelection')}</Text>
        <Picker selectedValue={this.state.pickerSelection}
            onValueChange={(value, itemIndex) => this.setState({ pickerSelection: this.changeLanguage(value) })}>
            <Picker.Item label = "Spanish" value = "es-US" />
            <Picker.Item label = "English" value = "en-US" />
            <Picker.Item label = "portuguese" value = "pt-BR" />    
        </Picker>
      </View>
    );
  }
}

closed #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.