@umituz/react-native-settings 5.3.32 → 5.3.34

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
@@ -1,84 +1,84 @@
1
1
  {
2
2
  "name": "@umituz/react-native-settings",
3
- "version": "5.3.32",
3
+ "version": "5.3.34",
4
4
  "description": "Complete settings hub for React Native apps - consolidated package with settings, localization, about, legal, appearance, feedback, FAQs, rating, and gamification",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./dist/index.d.ts",
7
7
  "sideEffects": false,
8
8
  "exports": {
9
9
  ".": {
10
- "react-native": "./src/index.ts",
11
10
  "types": "./dist/index.d.ts",
11
+ "react-native": "./src/index.ts",
12
12
  "default": "./src/index.ts"
13
13
  },
14
14
  "./localization": {
15
- "react-native": "./src/domains/localization/index.ts",
16
15
  "types": "./dist/domains/localization/index.d.ts",
16
+ "react-native": "./src/domains/localization/index.ts",
17
17
  "default": "./src/domains/localization/index.ts"
18
18
  },
19
19
  "./appearance": {
20
- "react-native": "./src/domains/appearance/index.ts",
21
20
  "types": "./dist/domains/appearance/index.d.ts",
21
+ "react-native": "./src/domains/appearance/index.ts",
22
22
  "default": "./src/domains/appearance/index.ts"
23
23
  },
24
24
  "./feedback": {
25
- "react-native": "./src/domains/feedback/index.ts",
26
25
  "types": "./dist/domains/feedback/index.d.ts",
26
+ "react-native": "./src/domains/feedback/index.ts",
27
27
  "default": "./src/domains/feedback/index.ts"
28
28
  },
29
29
  "./rating": {
30
- "react-native": "./src/domains/rating/index.ts",
31
30
  "types": "./dist/domains/rating/index.d.ts",
31
+ "react-native": "./src/domains/rating/index.ts",
32
32
  "default": "./src/domains/rating/index.ts"
33
33
  },
34
34
  "./gamification": {
35
- "react-native": "./src/domains/gamification/index.ts",
36
35
  "types": "./dist/domains/gamification/index.d.ts",
36
+ "react-native": "./src/domains/gamification/index.ts",
37
37
  "default": "./src/domains/gamification/index.ts"
38
38
  },
39
39
  "./notifications": {
40
- "react-native": "./src/domains/notifications/index.ts",
41
40
  "types": "./dist/domains/notifications/index.d.ts",
41
+ "react-native": "./src/domains/notifications/index.ts",
42
42
  "default": "./src/domains/notifications/index.ts"
43
43
  },
44
44
  "./about": {
45
- "react-native": "./src/domains/about/index.ts",
46
45
  "types": "./dist/domains/about/index.d.ts",
46
+ "react-native": "./src/domains/about/index.ts",
47
47
  "default": "./src/domains/about/index.ts"
48
48
  },
49
49
  "./legal": {
50
- "react-native": "./src/domains/legal/index.ts",
51
50
  "types": "./dist/domains/legal/index.d.ts",
51
+ "react-native": "./src/domains/legal/index.ts",
52
52
  "default": "./src/domains/legal/index.ts"
53
53
  },
54
54
  "./faqs": {
55
- "react-native": "./src/domains/faqs/index.ts",
56
55
  "types": "./dist/domains/faqs/index.d.ts",
56
+ "react-native": "./src/domains/faqs/index.ts",
57
57
  "default": "./src/domains/faqs/index.ts"
58
58
  },
59
59
  "./disclaimer": {
60
- "react-native": "./src/domains/disclaimer/index.ts",
61
60
  "types": "./dist/domains/disclaimer/index.d.ts",
61
+ "react-native": "./src/domains/disclaimer/index.ts",
62
62
  "default": "./src/domains/disclaimer/index.ts"
63
63
  },
64
64
  "./cloud-sync": {
65
- "react-native": "./src/domains/cloud-sync/index.ts",
66
65
  "types": "./dist/domains/cloud-sync/index.d.ts",
66
+ "react-native": "./src/domains/cloud-sync/index.ts",
67
67
  "default": "./src/domains/cloud-sync/index.ts"
68
68
  },
69
69
  "./dev": {
70
- "react-native": "./src/domains/dev/index.ts",
71
70
  "types": "./dist/domains/dev/index.d.ts",
71
+ "react-native": "./src/domains/dev/index.ts",
72
72
  "default": "./src/domains/dev/index.ts"
73
73
  },
74
74
  "./video-tutorials": {
75
- "react-native": "./src/domains/video-tutorials/index.ts",
76
75
  "types": "./dist/domains/video-tutorials/index.d.ts",
76
+ "react-native": "./src/domains/video-tutorials/index.ts",
77
77
  "default": "./src/domains/video-tutorials/index.ts"
78
78
  },
79
79
  "./account": {
80
- "react-native": "./src/account.ts",
81
80
  "types": "./dist/account.d.ts",
81
+ "react-native": "./src/account.ts",
82
82
  "default": "./src/account.ts"
83
83
  },
84
84
  "./package.json": "./package.json"
@@ -14,6 +14,8 @@ interface LocalizationProviderProps {
14
14
  defaultLanguage?: string;
15
15
  }
16
16
 
17
+ const INIT_TIMEOUT_MS = 5000;
18
+
17
19
  export const LocalizationManager: React.FC<LocalizationProviderProps> = ({
18
20
  children,
19
21
  translations,
@@ -25,11 +27,30 @@ export const LocalizationManager: React.FC<LocalizationProviderProps> = ({
25
27
  useEffect(() => {
26
28
  let isMounted = true;
27
29
 
30
+ // Safety timeout: proceed even if initialization hangs
31
+ const safetyTimer = setTimeout(() => {
32
+ if (isMounted && !isI18nReady) {
33
+ if (isDev()) {
34
+ console.warn('[LocalizationManager] Initialization timed out, proceeding with defaults');
35
+ }
36
+ // Initialize i18n synchronously with defaults as fallback
37
+ try {
38
+ if (!require('i18next').default?.isInitialized) {
39
+ I18nInitializer.initialize(translations, defaultLanguage);
40
+ }
41
+ } catch {
42
+ // Best effort
43
+ }
44
+ setIsI18nReady(true);
45
+ }
46
+ }, INIT_TIMEOUT_MS);
47
+
28
48
  const initializeLocalization = async () => {
29
49
  try {
30
50
  I18nInitializer.initialize(translations, defaultLanguage);
31
51
  await initialize();
32
52
  if (isMounted) {
53
+ clearTimeout(safetyTimer);
33
54
  setIsI18nReady(true);
34
55
  }
35
56
  } catch (error) {
@@ -37,7 +58,8 @@ export const LocalizationManager: React.FC<LocalizationProviderProps> = ({
37
58
  console.error('[LocalizationManager] Initialization failed:', error);
38
59
  }
39
60
  if (isMounted) {
40
- setIsI18nReady(true); // Set ready even on error to prevent indefinite loading
61
+ clearTimeout(safetyTimer);
62
+ setIsI18nReady(true);
41
63
  }
42
64
  }
43
65
  };
@@ -46,6 +68,7 @@ export const LocalizationManager: React.FC<LocalizationProviderProps> = ({
46
68
 
47
69
  return () => {
48
70
  isMounted = false;
71
+ clearTimeout(safetyTimer);
49
72
  };
50
73
  }, [translations, defaultLanguage, initialize]);
51
74