@umituz/react-native-localization 3.7.3 → 3.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -17,13 +17,21 @@ export const useLanguageSelection = () => {
|
|
|
17
17
|
}, [searchQuery]);
|
|
18
18
|
|
|
19
19
|
const handleLanguageSelect = async (code: string, onComplete?: () => void) => {
|
|
20
|
-
|
|
20
|
+
if (__DEV__) {
|
|
21
|
+
console.log('[useLanguageSelection] handleLanguageSelect called:', { code, currentLanguage });
|
|
22
|
+
}
|
|
21
23
|
setSelectedCode(code);
|
|
22
|
-
|
|
24
|
+
if (__DEV__) {
|
|
25
|
+
console.log('[useLanguageSelection] Calling setLanguage...');
|
|
26
|
+
}
|
|
23
27
|
await setLanguage(code);
|
|
24
|
-
|
|
28
|
+
if (__DEV__) {
|
|
29
|
+
console.log('[useLanguageSelection] Language changed to:', code);
|
|
30
|
+
}
|
|
25
31
|
onComplete?.();
|
|
26
|
-
|
|
32
|
+
if (__DEV__) {
|
|
33
|
+
console.log('[useLanguageSelection] onComplete callback executed');
|
|
34
|
+
}
|
|
27
35
|
};
|
|
28
36
|
|
|
29
37
|
return {
|
|
@@ -71,7 +71,9 @@ export const LanguageItem: React.FC<LanguageItemProps> = ({
|
|
|
71
71
|
customStyles?.languageItem,
|
|
72
72
|
]}
|
|
73
73
|
onPress={() => {
|
|
74
|
-
|
|
74
|
+
if (__DEV__) {
|
|
75
|
+
console.log('[LanguageItem] TouchableOpacity pressed:', item.code, item.nativeName);
|
|
76
|
+
}
|
|
75
77
|
onSelect(item.code);
|
|
76
78
|
}}
|
|
77
79
|
activeOpacity={0.7}
|
|
@@ -5,13 +5,14 @@ import {
|
|
|
5
5
|
useAppDesignTokens,
|
|
6
6
|
AtomicText,
|
|
7
7
|
ListItem,
|
|
8
|
-
|
|
8
|
+
useAppNavigation,
|
|
9
9
|
} from '@umituz/react-native-design-system';
|
|
10
10
|
import { useLocalization } from '../../infrastructure/hooks/useLocalization';
|
|
11
11
|
import { getLanguageByCode } from '../../infrastructure/config/languages';
|
|
12
12
|
|
|
13
13
|
export interface LanguageSectionConfig {
|
|
14
14
|
route?: string;
|
|
15
|
+
onPress?: () => void;
|
|
15
16
|
title?: string;
|
|
16
17
|
description?: string;
|
|
17
18
|
defaultLanguageDisplay?: string;
|
|
@@ -30,6 +31,7 @@ export const LanguageSection: React.FC<LanguageSectionProps> = ({
|
|
|
30
31
|
}) => {
|
|
31
32
|
const tokens = useAppDesignTokens();
|
|
32
33
|
const { t, currentLanguage } = useLocalization();
|
|
34
|
+
const navigation = useAppNavigation();
|
|
33
35
|
|
|
34
36
|
const route = config?.route || 'LanguageSelection';
|
|
35
37
|
const title = config?.title || t('settings.languageSelection.title') || 'Language';
|
|
@@ -42,7 +44,11 @@ export const LanguageSection: React.FC<LanguageSectionProps> = ({
|
|
|
42
44
|
: defaultLanguageDisplay;
|
|
43
45
|
|
|
44
46
|
const handlePress = () => {
|
|
45
|
-
|
|
47
|
+
if (config?.onPress) {
|
|
48
|
+
config.onPress();
|
|
49
|
+
} else {
|
|
50
|
+
navigation.navigate(route as never);
|
|
51
|
+
}
|
|
46
52
|
};
|
|
47
53
|
|
|
48
54
|
return (
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
SearchBar,
|
|
12
12
|
ScreenLayout,
|
|
13
13
|
NavigationHeader,
|
|
14
|
-
|
|
14
|
+
useAppNavigation,
|
|
15
15
|
} from '@umituz/react-native-design-system';
|
|
16
16
|
import { useLanguageSelection } from '../../infrastructure/hooks/useLanguageSelection';
|
|
17
17
|
import { LanguageItem } from '../components/LanguageItem';
|
|
@@ -29,6 +29,7 @@ export const LanguageSelectionScreen: React.FC<LanguageSelectionScreenProps> = (
|
|
|
29
29
|
testID = 'language-selection-screen',
|
|
30
30
|
}) => {
|
|
31
31
|
const tokens = useAppDesignTokens();
|
|
32
|
+
const navigation = useAppNavigation();
|
|
32
33
|
const {
|
|
33
34
|
searchQuery,
|
|
34
35
|
setSearchQuery,
|
|
@@ -38,12 +39,18 @@ export const LanguageSelectionScreen: React.FC<LanguageSelectionScreenProps> = (
|
|
|
38
39
|
} = useLanguageSelection();
|
|
39
40
|
|
|
40
41
|
const onSelect = async (code: string) => {
|
|
41
|
-
|
|
42
|
+
if (__DEV__) {
|
|
43
|
+
console.log('[LanguageSelectionScreen] onSelect called with code:', code);
|
|
44
|
+
}
|
|
42
45
|
await handleLanguageSelect(code, () => {
|
|
43
|
-
|
|
44
|
-
|
|
46
|
+
if (__DEV__) {
|
|
47
|
+
console.log('[LanguageSelectionScreen] Navigating back using context navigation');
|
|
48
|
+
}
|
|
49
|
+
navigation.goBack();
|
|
45
50
|
});
|
|
46
|
-
|
|
51
|
+
if (__DEV__) {
|
|
52
|
+
console.log('[LanguageSelectionScreen] Language change completed');
|
|
53
|
+
}
|
|
47
54
|
};
|
|
48
55
|
|
|
49
56
|
const renderItem = ({ item }: { item: Language }) => {
|
|
@@ -86,7 +93,7 @@ export const LanguageSelectionScreen: React.FC<LanguageSelectionScreenProps> = (
|
|
|
86
93
|
if (onBackPress) {
|
|
87
94
|
onBackPress();
|
|
88
95
|
} else {
|
|
89
|
-
|
|
96
|
+
navigation.goBack();
|
|
90
97
|
}
|
|
91
98
|
};
|
|
92
99
|
|