@@ -4,41 +4,30 @@ import { router } from 'expo-router';
4
4
import { useEffect , useRef , useState } from 'react' ;
5
5
import { TouchableOpacity , useColorScheme } from 'react-native' ;
6
6
import PagerView from 'react-native-pager-view' ;
7
- import AsyncStorage from '@react-native-async-storage/async-storage' ;
7
+ import { useTranslation } from 'react-i18next' ;
8
+ import LanguagePicker from '@/components/LanguagePicker' ;
9
+
10
+
8
11
type Page = {
9
12
image : any ;
10
13
content : string ;
11
14
} ;
12
15
13
- const pages : Page [ ] = [
14
- {
15
- image : require ( '@/assets/images/onboarding/1.png' ) ,
16
- content : "Optimize your organization's potential with Performance Management/Analytics." ,
17
- } ,
18
- {
19
- image : require ( '@/assets/images/onboarding/2.png' ) ,
20
- content : 'Identify top performers, discover hidden talent, and optimize your workforce.' ,
21
- } ,
22
- {
23
- image : require ( '@/assets/images/onboarding/3.png' ) ,
24
- content : 'Unlock the potential of a Continuous & Tight Feedback Loop.' ,
25
- } ,
26
- ] ;
27
-
28
16
export default function AppOnboarding ( ) {
17
+ const { t, i18n } = useTranslation ( ) ;
29
18
const colorScheme = useColorScheme ( ) ;
30
19
const pagerViewRef = useRef < PagerView > ( null ) ;
31
20
const [ page , setPage ] = useState < number > ( 0 ) ;
32
21
33
22
const textColor = colorScheme === 'dark' ? 'text-gray-100' : 'text-gray-800' ;
34
23
const bgColor = colorScheme === 'dark' ? 'bg-primary-dark' : 'bg-secondary-light' ;
35
24
25
+
36
26
const getDotColor = ( index : number ) => ( index === page ? 'bg-action-500' : 'bg-white' ) ;
37
27
const [ token , setToken ] = useState < string | null > ( null ) ;
38
28
39
29
40
30
useEffect ( ( ) => {
41
- // check if user have signed in before
42
31
43
32
const interval = setInterval ( ( ) => {
44
33
setPage ( page === 2 ? 0 : page + 1 ) ;
@@ -51,8 +40,24 @@ export default function AppOnboarding() {
51
40
pagerViewRef . current ?. setPage ( page ) ;
52
41
} , [ page ] ) ;
53
42
43
+ const pages : Page [ ] = [
44
+ {
45
+ image : require ( '@/assets/images/onboarding/1.png' ) ,
46
+ content : t ( 'onboarding.page1' ) ,
47
+ } ,
48
+ {
49
+ image : require ( '@/assets/images/onboarding/2.png' ) ,
50
+ content : t ( 'onboarding.page2' ) ,
51
+ } ,
52
+ {
53
+ image : require ( '@/assets/images/onboarding/3.png' ) ,
54
+ content : t ( 'onboarding.page3' ) ,
55
+ } ,
56
+ ] ;
57
+
54
58
return (
55
59
< >
60
+ { /* Pager View for Onboarding Screens */ }
56
61
< PagerView
57
62
initialPage = { page }
58
63
style = { { minHeight : 580 } }
@@ -65,7 +70,7 @@ export default function AppOnboarding() {
65
70
< Image
66
71
source = { page . image }
67
72
contentFit = "contain"
68
- className = "mb-6 justify-center items-end "
73
+ className = "items-end justify-center mb-6 "
69
74
style = { { width : '100%' , flex : 1 } }
70
75
/>
71
76
< Text
@@ -77,18 +82,28 @@ export default function AppOnboarding() {
77
82
</ View >
78
83
) ) }
79
84
</ PagerView >
85
+
86
+ { /* Pagination Dots */ }
80
87
< View className = { `flex-1 flex-row justify-center items-center gap-3 ${ bgColor } ` } >
81
- < View className = { `rounded-full bg-action-500 w-4 h-4 ${ getDotColor ( 0 ) } ` } > </ View >
88
+ < View className = { `rounded-full w-4 h-4 ${ getDotColor ( 0 ) } ` } > </ View >
82
89
< View className = { `rounded-full w-4 h-4 ${ getDotColor ( 1 ) } ` } > </ View >
83
90
< View className = { `rounded-full w-4 h-4 ${ getDotColor ( 2 ) } ` } > </ View >
84
91
</ View >
92
+
93
+ { /* Language Switcher */ }
94
+ < View className = "mb-4" >
95
+ < LanguagePicker />
96
+ </ View >
97
+
98
+
99
+ { /* Get Started Button */ }
85
100
< View className = { `flex-1 flex-row justify-center items-center ${ bgColor } ` } >
86
101
< TouchableOpacity >
87
102
< Text
88
103
className = "text-lg font-Inter-Medium dark:text-white"
89
104
onPress = { ( ) => router . push ( '/auth/login' ) }
90
105
>
91
- Get Started
106
+ { t ( 'onboarding.getStarted' ) }
92
107
</ Text >
93
108
</ TouchableOpacity >
94
109
</ View >
0 commit comments