Skip to content

Commit 03a9ed8

Browse files
committed
refined onboarding screen
1 parent 99b265c commit 03a9ed8

File tree

2 files changed

+86
-76
lines changed

2 files changed

+86
-76
lines changed

Screens/Initial.js

Lines changed: 55 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,58 @@
1-
import AsyncStorage from "@react-native-async-storage/async-storage";
2-
import {useContext, useEffect} from "react";
3-
import {View} from "react-native";
4-
import Context from "../Context/Context";
1+
/* eslint-disable react-hooks/exhaustive-deps */
2+
/* eslint-disable react/react-in-jsx-scope */
3+
/* eslint-disable react-native/no-inline-styles */
4+
import AsyncStorage from '@react-native-async-storage/async-storage';
5+
import {useEffect} from 'react';
6+
import {Dimensions, View} from 'react-native';
7+
import {Text} from 'react-native-animatable';
58

69
export const Initial = ({navigation}) => {
7-
const {Style1}=useContext(Context)
8-
async function Get(){
9-
const val=await AsyncStorage.getItem('On');
10-
console.log(val)
11-
if(val==='T'){
12-
navigation.replace('HomePage')
13-
14-
}else{
15-
navigation.replace('Onboarding')
16-
}
10+
async function Get() {
11+
const val = await AsyncStorage.getItem('On');
12+
console.log(val);
13+
if (val === 'T') {
14+
navigation.replace('HomePage');
15+
} else {
16+
navigation.replace('Onboarding');
1717
}
18-
useEffect(() => {
19-
Get()
20-
}, []);
21-
return (
22-
<View style={{
23-
backgroundColor:"black",
24-
flex:1
25-
}}></View>
26-
)
27-
}
18+
}
19+
const width = Dimensions.get('window').width;
20+
useEffect(() => {
21+
setTimeout(() => {
22+
Get();
23+
}, 1400);
24+
}, []);
25+
return (
26+
<View
27+
style={{
28+
backgroundColor: '#1e1b38',
29+
flex: 1,
30+
justifyContent: 'center',
31+
alignItems: 'center',
32+
}}>
33+
<Text
34+
animation={'fadeIn'}
35+
delay={300}
36+
duration={1000}
37+
style={{
38+
color: 'white',
39+
fontSize: width * 0.12,
40+
fontWeight: 'bold',
41+
textAlign: 'center',
42+
}}>
43+
O2 AI
44+
</Text>
45+
<Text
46+
animation={'fadeIn'}
47+
delay={700}
48+
duration={300}
49+
style={{
50+
color: 'white',
51+
fontSize: width * 0.03,
52+
textAlign: 'center',
53+
}}>
54+
best AI experience.
55+
</Text>
56+
</View>
57+
);
58+
};

Screens/OnboardingScreen.js

Lines changed: 31 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,34 @@
1+
/* eslint-disable react-native/no-inline-styles */
2+
/* eslint-disable react/react-in-jsx-scope */
13
import Onboarding from 'react-native-onboarding-swiper';
2-
import {Image} from "react-native";
3-
import AsyncStorage from "@react-native-async-storage/async-storage";
4+
import AsyncStorage from '@react-native-async-storage/async-storage';
5+
import {Dimensions} from 'react-native';
46

57
export const OnboardingScreen = ({navigation}) => {
6-
return (
7-
<Onboarding
8-
skipToPage={3}
9-
titleStyles={{
10-
fontSize:30
11-
}}
12-
onDone={async ()=>{
13-
await AsyncStorage.setItem('On', "T");
14-
navigation.replace("HomePage")
15-
}}
16-
pages={[
17-
{
18-
backgroundColor: '#045d8d',
19-
image: <Image source={require('../Assets/logo.jpg')} style={{
20-
height:200,
21-
width:200,
22-
borderRadius:10
23-
}}/>,
24-
title: 'Welcome to O2.Ai',
25-
subtitle: 'Your personal Ai assistant',
26-
},
27-
{
28-
backgroundColor: '#257e54',
29-
image: <Image source={require('../Assets/mail.gif')} style={{
30-
height:200,
31-
width:200,
32-
borderRadius:1500
33-
}}/>,
34-
title: 'Mail Generation',
35-
subtitle: 'Generate professional mails with just one tap',
36-
},
37-
{
38-
backgroundColor: '#709f87',
39-
image: <Image source={require('../Assets/code.gif')} style={{
40-
height:200,
41-
width:200,
42-
borderRadius:1500
43-
}}/>,
44-
title: 'Code Generation',
45-
subtitle: 'A professional coder at your finger tip.',
46-
},
47-
{
48-
backgroundColor: '#333380',
49-
title: 'Let\'s Go !',
50-
subtitle:""
51-
},
52-
]}
53-
/>
54-
)
55-
}
8+
const width = Dimensions.get('window').width;
9+
return (
10+
<Onboarding
11+
skipToPage={1}
12+
titleStyles={{
13+
fontSize: width * 0.3,
14+
fontWeight: 'bold',
15+
}}
16+
onDone={async () => {
17+
await AsyncStorage.setItem('On', 'T');
18+
navigation.replace('HomePage');
19+
}}
20+
pages={[
21+
{
22+
backgroundColor: '#262152',
23+
title: 'O2 AI',
24+
subtitle: 'Your personal AI assistant \n for all your needs',
25+
},
26+
{
27+
backgroundColor: '#1e1b38',
28+
title: "Let's Go !",
29+
subtitle: '',
30+
},
31+
]}
32+
/>
33+
);
34+
};

0 commit comments

Comments
 (0)