react-native-i18n
react-native-i18n copied to clipboard
Translation not updating navigationOptions when changing language
navigationOptions can not update language,why? Who has the same problem? title,Always show English
static navigationOptions = { title:I18n.t('title'), };
You try import and change language in Root Component, and then child component update a language.
Ok, I would recomend to do something like this:
<Button onClick={ () => {
...
this.props.navigation.setParams({ refresh: true });
}
/>
tl;dr: It doesn't seem to have a big difference, if you pass same value all the time.
If you use
navigationOptions: {
title: i18n.t('home')
}
it will not update when change language, but if you create function instead of return object
navigationOptions: () => ({
title: i18n.t('home')
})
it will update
If you use
navigationOptions: { title: i18n.t('home') }
it will not update when change language, but if you create function instead of return object
navigationOptions: () => ({ title: i18n.t('home') })
it will update
You are superman. Thanks a lot. :D