Skip to content
This repository was archived by the owner on Oct 13, 2025. It is now read-only.

Commit c416f95

Browse files
committed
refactor: changed the start page and add animations
1 parent f2a336e commit c416f95

File tree

1 file changed

+86
-23
lines changed

1 file changed

+86
-23
lines changed

DisasterWatch/app/index.jsx

Lines changed: 86 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,95 @@
11
import { StatusBar } from "expo-status-bar";
2-
import { ScrollView, Text, View } from "react-native";
3-
import { Redirect, router } from "expo-router";
4-
import "../global.css";
2+
import { ScrollView, Text, View, Animated, Dimensions } from "react-native";
3+
import { router } from "expo-router";
54
import { SafeAreaView } from "react-native-safe-area-context";
5+
import { useEffect, useRef } from "react";
66
import CustomButton from "../components/customButton";
77
import TitleText from "../components/titleText";
8+
import "../global.css";
9+
10+
const { width, height } = Dimensions.get('window');
11+
12+
export default function WelcomePage() {
13+
const fadeAnim = useRef(new Animated.Value(0)).current;
14+
const slideAnim = useRef(new Animated.Value(50)).current;
15+
16+
useEffect(() => {
17+
Animated.parallel([
18+
Animated.timing(fadeAnim, {
19+
toValue: 1,
20+
duration: 1000,
21+
useNativeDriver: true,
22+
}),
23+
Animated.timing(slideAnim, {
24+
toValue: 0,
25+
duration: 800,
26+
useNativeDriver: true,
27+
}),
28+
]).start();
29+
}, []);
30+
31+
const handleGetStarted = () => {
32+
Animated.timing(fadeAnim, {
33+
toValue: 0,
34+
duration: 300,
35+
useNativeDriver: true,
36+
}).start(() => {
37+
router.push("/signIn");
38+
});
39+
};
840

9-
export default function App() {
1041
return (
11-
<SafeAreaView className="bg-neutral-800 h-full">
12-
<ScrollView contentContainerStyle={{ height: `[85vh]` }}>
13-
<View className="w-full justify-center items-center min-h-[85vh] px-4">
14-
<TitleText
15-
title="Welcome to"
16-
containerStyles="text-neutral-100 text-2xl font-bold"
17-
/>
18-
<TitleText
19-
title="Disaster Watch"
20-
containerStyles="text-4xl font-extrabold text-neutral-100"
21-
/>
22-
<CustomButton
23-
title="Get Started"
24-
handlePress={() => router.push("/signIn")}
25-
containerStyles="w-full mt-3 rounded-xl bg-neutral-300 h-[45px]"
26-
/>
27-
</View>
42+
<SafeAreaView className="bg-neutral-800 flex-1">
43+
<StatusBar style="light" backgroundColor="#262626" />
44+
45+
<ScrollView
46+
contentContainerStyle={{
47+
flexGrow: 1,
48+
justifyContent: 'center',
49+
minHeight: height * 0.85,
50+
}}
51+
showsVerticalScrollIndicator={false}
52+
>
53+
<Animated.View
54+
className="w-full justify-center items-center px-6"
55+
style={{
56+
opacity: fadeAnim,
57+
transform: [{ translateY: slideAnim }],
58+
}}
59+
>
60+
{/* Logo or Image */}
61+
<View className="mb-8">
62+
<TitleText
63+
title="Welcome to"
64+
containerStyles="text-neutral-100 text-2xl font-bold text-center mb-2"
65+
/>
66+
<TitleText
67+
title="Disaster Watch"
68+
containerStyles="text-5xl font-extrabold text-neutral-100 text-center"
69+
/>
70+
</View>
71+
72+
<Text className="text-neutral-400 text-center mb-12 text-lg">
73+
Stay informed and prepared for natural disasters in your area
74+
</Text>
75+
76+
<View className="w-full space-y-4">
77+
<CustomButton
78+
title="Get Started"
79+
handlePress={handleGetStarted}
80+
containerStyles="w-full rounded-xl bg-blue-500 h-[50px]"
81+
textStyles="text-white font-bold text-lg"
82+
/>
83+
84+
<CustomButton
85+
title="Learn More"
86+
handlePress={() => {/* navigation to info page */}}
87+
containerStyles="mt-2 w-full rounded-xl border-2 border-neutral-400 h-[50px]"
88+
textStyles="text-neutral-100 font-semibold text-lg"
89+
/>
90+
</View>
91+
</Animated.View>
2892
</ScrollView>
29-
<StatusBar style="light" backgroundColor="#1212" />
3093
</SafeAreaView>
3194
);
32-
}
95+
}

0 commit comments

Comments
 (0)