I can't restart the app using expo updates to change language

I’m using “expo-localization” & “i18n-js” to localize my app as ‘Arabic RTL’ & ‘English’, in the last 3 years I used to restart the whole app to force RTL using “expo-updates.reloadAsync()” but now I got this message:

How I can test it ?!!

Hi @afj_951

hmmm… I see that error is coming from here:

The latest change was made in this PR

The PR says (amongst other things):

If an app is using expo-updates and is built with the EX_UPDATES_NATIVE_DEBUG environment variable set to allow native debugging, updates work correctly on the native side, and download and run automatically as expected. However, some methods in the Updates API (checkForUpdateAsync(), fetchUpdateAsync(), reloadAsync()) are currently implemented to only work in release builds.

So you might be able to workaround this by setting the EX_UPDATES_NATIVE_DEBUG environment variable when creating the development build. I’m not sure what other effects this environment variable might cause.

Recent versions of React Native also have a built-in reload function. This apparently only works in development mode. I haven’t tried it. Maybe see if it works for you.

If all else fails, you can probably use patch-package to disable the code in expo-updates that throws the exception.

Hi @afj_951

The Expo developers believe that the following change would fix the problem:

% cat patches/expo-updates+0.18.13.patch
diff --git a/node_modules/expo-updates/build/Updates.js b/node_modules/expo-updates/build/Updates.js
index 30ec0f1..5844505 100644
--- a/node_modules/expo-updates/build/Updates.js
+++ b/node_modules/expo-updates/build/Updates.js
@@ -114,7 +114,7 @@ export async function reloadAsync() {
     if (!ExpoUpdates.reload) {
         throw new UnavailabilityError('Updates', 'reloadAsync');
     }
-    if (!ExpoUpdates?.nativeDebug && (__DEV__ || isUsingExpoDevelopmentClient)) {
+    if (!ExpoUpdates?.nativeDebug && (__DEV__ && !isUsingExpoDevelopmentClient)) {
         throw new CodedError('ERR_UPDATES_DISABLED', `You cannot use the Updates module in development mode in a production app. ${manualUpdatesInstructions}`);
     }
     await ExpoUpdates.reload();

Could you give that a try, using patch-package

Assuming it works for you, they will make the change.

I will try it and respond to you

Thank you so much.

1 Like

It is working very well, thank you.

Should I open a PR in expo-updates repo ?

I think rather post a comment here to say that the fix works for you:

[expo-updates] Make Updates API work with native debug #21253

Mention @douglowder

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