react-native-i18n icon indicating copy to clipboard operation
react-native-i18n copied to clipboard

Translation not updating navigationOptions when changing language

Open jiangjiatao opened this issue 6 years ago • 4 comments

navigationOptions can not update language,why? Who has the same problem? title,Always show English

static navigationOptions = { title:I18n.t('title'), };

jiangjiatao avatar Aug 29 '18 03:08 jiangjiatao

You try import and change language in Root Component, and then child component update a language.

kudane avatar Oct 29 '18 15:10 kudane

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.

hrdyjan1 avatar Mar 03 '19 09:03 hrdyjan1

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

Mlobaievskyi avatar Apr 17 '19 12:04 Mlobaievskyi

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

vinhdothe93 avatar Feb 13 '20 05:02 vinhdothe93