0

I am trying to find solution to toggle between ltr and rtl view in react native expo. I have tried this solution:

import * as Updates from "expo-updates";

import {
  I18nManager,
} from "react-native";
// i18 is intialised object of i18next

const changeLanguage = (value) => {
    i18n
      .changeLanguage(value)
      .then(() => {
        setLanguage(value);
        if (value === "ar") {
          if (true && Platform.OS !== "web") {
            I18nManager.allowRTL(true);
            I18nManager.forceRTL(true);
            Updates.reloadAsync();
          }
        } else {
          I18nManager.allowRTL(false);
          I18nManager.forceRTL(false);
          Updates.reloadAsync();
        }
      })
      .catch((err) => console.log(err));
  };

but Updates.reloadAsync(); results in an error:

Error: You cannot use the Updates module in development mode in a production app. To test manual updates, publish your project using expo publish and open the published version in this development client.

So rtl to ltr and ltr to rtl not working.

I have also tried expo publish then also ltr to rtl not working. please give me a solution for that. can you provide me alternative solution for reloading app or if anything wrong i am following in my code then please help me with that.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Rutvik JR
  • 1
  • 1

0 Answers0