-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.tsx
More file actions
51 lines (44 loc) · 1.39 KB
/
App.tsx
File metadata and controls
51 lines (44 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// App.tsx (or your main app entry file)
import React, { useEffect, useState } from 'react';
import { View, ActivityIndicator, StyleSheet } from 'react-native';
import { initializeI18nWithSavedLanguage } from './src/config/localization/i18n';
import { NotificationScreen } from './src/screens/NotificationScreen';
// Import your navigation or main component here
const App: React.FC = () => {
const [isInitialized, setIsInitialized] = useState(false);
useEffect(() => {
const initializeApp = async () => {
try {
// Initialize i18n with saved language preference
await initializeI18nWithSavedLanguage();
setIsInitialized(true);
} catch (error) {
console.error('Error initializing app:', error);
// Continue with default language even if there's an error
setIsInitialized(true);
}
};
initializeApp();
}, []);
// Show loading screen while initializing
if (!isInitialized) {
return (
<View style={styles.loadingContainer}>
<ActivityIndicator size="large" color="#0000ff" />
</View>
);
}
// Your main app content
return <NotificationScreen />;
// Or if you have navigation:
// return <YourNavigationContainer />;
};
const styles = StyleSheet.create({
loadingContainer: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#f5f5f5'
}
});
export default App;