basic layout created and welcome onboarding screen implemented
This commit is contained in:
committed by
GitHub
parent
a72a83ebe3
commit
77030fd4c2
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
+6
-3
@@ -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
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user