basic layout created and welcome onboarding screen implemented

This commit is contained in:
Sanidhya Kumar Verma
2024-08-29 08:29:58 +00:00
committed by GitHub
parent a72a83ebe3
commit 77030fd4c2
16 changed files with 481 additions and 12 deletions
+13
View File
@@ -0,0 +1,13 @@
import { Stack } from "expo-router";
const AuthLayout = () => {
return (
<Stack>
<Stack.Screen name="welcome" options={{ headerShown: false }} />
<Stack.Screen name="sign-up" options={{ headerShown: false }} />
<Stack.Screen name="sign-in" options={{ headerShown: false }} />
</Stack>
);
};
export default AuthLayout;
+12
View File
@@ -0,0 +1,12 @@
import { Text } from "react-native";
import { SafeAreaView } from "react-native-safe-area-context";
const SignIn = () => {
return (
<SafeAreaView>
<Text>SignIn</Text>
</SafeAreaView>
);
};
export default SignIn;
+12
View File
@@ -0,0 +1,12 @@
import { Text } from "react-native";
import { SafeAreaView } from "react-native-safe-area-context";
const SignUp = () => {
return (
<SafeAreaView>
<Text>SignUp</Text>
</SafeAreaView>
);
};
export default SignUp;
+65
View File
@@ -0,0 +1,65 @@
import { CustomButton } from "@/components/custom-button";
import { onboarding } from "@/constants";
import { router } from "expo-router";
import { useRef, useState } from "react";
import { Image, Text, TouchableOpacity, View } from "react-native";
import { SafeAreaView } from "react-native-safe-area-context";
import Swiper from "react-native-swiper";
const Welcome = () => {
const swiperRef = useRef<Swiper>(null);
const [activeIndex, setActiveIndex] = useState(0);
const isLastSlide = activeIndex === onboarding.length - 1;
return (
<SafeAreaView className="flex h-full items-center justify-between bg-white">
<TouchableOpacity
onPress={() => router.replace("/(auth)/sign-up")}
className="w-full flex justify-end items-end p-5"
>
<Text className="text-black text-base font-JakartaBold">Skip</Text>
</TouchableOpacity>
<Swiper
ref={swiperRef}
loop={false}
dot={<View className="w-8 h-1 mx-1 bg-[#E2E8F0] rounded-full" />}
activeDot={<View className="w-8 h-1 mx-1 bg-[#0286FF] rounded-full" />}
index={activeIndex}
onIndexChanged={setActiveIndex}
>
{onboarding.map((item) => (
<View key={item.id} className="flex items-center justify-center p-5">
<Image
source={item.image}
className="w-full h-[300px]"
resizeMode="contain"
/>
<View className="flex flex-row items-center justify-center w-full mt-10">
<Text className="text-black text-3xl font-bold mx-10 text-center">
{item.title}
</Text>
</View>
<Text className="text-base font-JakartaSemiBold text-center text-[#858585] mx-10 mt-3">
{item.description}
</Text>
</View>
))}
</Swiper>
<CustomButton
onPress={() =>
isLastSlide
? router.replace("/(auth)/sign-up")
: swiperRef.current?.scrollBy(1)
}
title={isLastSlide ? "Get Started" : "Next"}
className="w-11/12 mt-10"
/>
</SafeAreaView>
);
};
export default Welcome;
View File
+12
View File
@@ -0,0 +1,12 @@
import { Text } from "react-native";
import { SafeAreaView } from "react-native-safe-area-context";
const Chat = () => {
return (
<SafeAreaView>
<Text>Chat</Text>
</SafeAreaView>
);
};
export default Chat;
+12
View File
@@ -0,0 +1,12 @@
import { Text } from "react-native";
import { SafeAreaView } from "react-native-safe-area-context";
const Home = () => {
return (
<SafeAreaView>
<Text>Home</Text>
</SafeAreaView>
);
};
export default Home;
+12
View File
@@ -0,0 +1,12 @@
import { Text } from "react-native";
import { SafeAreaView } from "react-native-safe-area-context";
const Profile = () => {
return (
<SafeAreaView>
<Text>Profile</Text>
</SafeAreaView>
);
};
export default Profile;
+12
View File
@@ -0,0 +1,12 @@
import { Text } from "react-native";
import { SafeAreaView } from "react-native-safe-area-context";
const Rides = () => {
return (
<SafeAreaView>
<Text>Rides</Text>
</SafeAreaView>
);
};
export default Rides;
View File
+6 -3
View File
@@ -7,7 +7,7 @@ import "react-native-reanimated";
// Prevent the splash screen from auto-hiding before asset loading is complete.
SplashScreen.preventAutoHideAsync();
export default function RootLayout() {
const RootLayout = () => {
const [loaded] = useFonts({
"Jakarta-Bold": require("../assets/fonts/PlusJakartaSans-Bold.ttf"),
"Jakarta-ExtraBold": require("../assets/fonts/PlusJakartaSans-ExtraBold.ttf"),
@@ -31,7 +31,10 @@ export default function RootLayout() {
return (
<Stack>
<Stack.Screen name="index" options={{ headerShown: false }} />
<Stack.Screen name="+not-found" />
<Stack.Screen name="(root)" options={{ headerShown: false }} />
<Stack.Screen name="(auth)" options={{ headerShown: false }} />
</Stack>
);
}
};
export default RootLayout;
+4 -9
View File
@@ -1,12 +1,7 @@
import { Text } from "react-native";
import { SafeAreaView } from "react-native-safe-area-context";
import { Redirect } from "expo-router";
const Home = () => {
return (
<SafeAreaView>
<Text>Home</Text>
</SafeAreaView>
);
const App = () => {
return <Redirect href="/(auth)/welcome" />;
};
export default Home;
export default App;