Expo update: reloadAsync crashes app in release build

863 Views Asked by At

I want to restart my react native app when I change the language of my app, Its an expo managed app with mobx persist for state management and right now I am using expo-update 's reloadAsync to do that and it works fine in development mode but in release build, it crashes the app and clears the Mobx store, I tried to find solutions but got no luck. Since my app is expo managed, I cant really use the react-native-restart library because it requires you to link it and is only supported in bare workflow and ejecting the app to bare workflow takes alot of configuration (I tried it and it introduced other problems) which I dont have time for. This is how restartAsync is implemented:

restart = async (): PVoid => {
    try {
      await reloadAsync();
    } catch (e) {
      console.log('Error', e);
    }
  };

And this is how I am choosing the language:

setLanguage = (v: UILanguage): void => {
    const {nav} = services;

    this.isSystemLanguage = v === 'System';
    this.language = this.languageFromUIToInternal(v);

    nav.restart();
  };

for language settings, I am using i18n-js. Expo version: 44, React Native version: 0.64.3 expo-update versions: 0.11.6 I used this boilerplate to make it so you can refer to: https://github.com/kanzitelli/expo-starter to find more info about the packages used. Any help or alternative methods are welcome. Thanks

Tried to eject from expo to use react-native-restart but got no luck. Searched for this issue in expo repository but didn't find anything. Tried finding alternatives but got no luck

0

There are 0 best solutions below