使用 react native i18n 更改 react native 应用程序中的语言不起作用

Din*_*tta 5 android react-native mobx react-native-android react-native-ios

当用户选择语言时,我试图在运行时更改我的应用程序的语言。我正在尝试这样做

import I18n from 'react-native-i18n'

onChangeLanguage = () => {
    console.log('String before change : >>> ', I18n.t('welcome'))
    I18n.locale = 'hi'
    console.log('String after change : >>> ', I18n.t('welcome'))
}
Run Code Online (Sandbox Code Playgroud)

在两个日志中,我得到了相同的 string 。我从这里参考。在此参考中,有一个使用 redux 的示例,但我的用例是使用 mobx。如果语言更改了如何重新渲染组件以反映语言更改。