mirror of
https://github.com/pezkuwichain/pezkuwi-mobile-app.git
synced 2026-04-22 01:57:56 +00:00
auto-commit for e4bb1e23-6b5c-463e-9696-382963669058
This commit is contained in:
+1
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
@@ -48,11 +48,11 @@ export default function LanguageSettingsScreen({ navigation }: any) {
|
||||
const handleLanguageChange = async (languageCode: string) => {
|
||||
setLoading(true);
|
||||
try {
|
||||
// Save to AsyncStorage and i18n (silent update)
|
||||
// Save to AsyncStorage and i18n
|
||||
await saveLanguage(languageCode);
|
||||
setSelectedLanguage(languageCode);
|
||||
|
||||
// Save to backend (fire and forget - non-blocking)
|
||||
// Save to backend
|
||||
if (user?.user_id) {
|
||||
const backendUrl = process.env.EXPO_PUBLIC_BACKEND_URL || 'http://localhost:8001';
|
||||
fetch(`${backendUrl}/api/auth/profile`, {
|
||||
@@ -67,11 +67,15 @@ export default function LanguageSettingsScreen({ navigation }: any) {
|
||||
}).catch(err => console.error('Error saving language to backend:', err));
|
||||
}
|
||||
|
||||
// Silent update - no alert, no navigation reset
|
||||
// Language will be applied on next screen render
|
||||
// FORCE APP RELOAD - this is the key fix
|
||||
setTimeout(() => {
|
||||
navigation.reset({
|
||||
index: 0,
|
||||
routes: [{ name: 'Home' }],
|
||||
});
|
||||
}, 500);
|
||||
} catch (error) {
|
||||
console.error('Error changing language:', error);
|
||||
// Even on error, we don't alert or redirect
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user