expo-localization example does not work with navigator

Expo CLI 3.22.0 environment info:
System:
OS: Windows 10 10.0.18362
Binaries:
Node: 14.4.0 - C:\Program Files\nodejs\node.EXE
npm: 6.14.4 - C:\Program Files\nodejs\npm.CMD
npmPackages:
expo: ~38.0.8 => 38.0.8
react: ~16.11.0 => 16.11.0
react-dom: ~16.11.0 => 16.11.0
react-native: https://github.com/expo/react-native/archive/sdk-38.0.1.tar.gz => 0.62.2
react-native-web: ~0.11.7 => 0.11.7
react-navigation: ^4.4.0 => 4.4.0

I’m trying to implement translation using the expo-localization extension and the example provided on
https://docs.expo.io/versions/latest/sdk/localization/
but it seems not to work with navigators… i have tab, stack and drawer navigators on my project, and the first time it loads i get the "[missing “…” translation], but it only occurs on the first time, if i modify any file and the app reloads then the translation will be loaded correctly.

So it seems the navigator is being rendered before the execution of line

i18n.translations = {
  en: { welcome: 'Hello' },
  ja: { welcome: 'こんにちは' },
};

How can i fix this, and guarantee translations will be loaded before navigator renders?

if(!fontLoaded || !pushRegistered) {

    return (

      <AppLoading startAsync={fetchFonts} onFinish={ () => setFontLoaded(true) } />

    )

  } else return (

    <Provider store={store}>

      <MainNavigator />

    </Provider>

  );

Fixed by upgrading to ReactNavigation 5

Glad to hear that you got things working and thanks for sharing your solution with the community.

Cheers,
Adam

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