Skip to content

Commit ebc28ef

Browse files
committed
fix: fix web page not reloading
1 parent 518a6d2 commit ebc28ef

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/core/i18n/utils.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type TranslateOptions from 'i18next';
22
import i18n from 'i18next';
33
import memoize from 'lodash.memoize';
44
import { useCallback } from 'react';
5-
import { I18nManager, NativeModules } from 'react-native';
5+
import { I18nManager, NativeModules, Platform } from 'react-native';
66
import { useMMKVString } from 'react-native-mmkv';
77
import RNRestart from 'react-native-restart';
88

@@ -31,8 +31,12 @@ export const changeLanguage = (lang: Language) => {
3131
} else {
3232
I18nManager.forceRTL(false);
3333
}
34-
if (__DEV__) NativeModules.DevSettings.reload();
35-
else RNRestart.restart();
34+
if (Platform.OS === 'ios' || Platform.OS === 'android') {
35+
if (__DEV__) NativeModules.DevSettings.reload();
36+
else RNRestart.restart();
37+
} else if (Platform.OS === 'web') {
38+
window.location.reload();
39+
}
3640
};
3741

3842
export const useSelectedLanguage = () => {

0 commit comments

Comments
 (0)