Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 32 additions & 3 deletions app/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
import { Redirect } from "expo-router"
import AsyncStorage from "@react-native-async-storage/async-storage";
import { Redirect } from "expo-router";
import { useEffect, useState } from "react";
import { ActivityIndicator } from "react-native";
import { IS_ONBOARDING_SKIPPED } from "./utils/storageKeys";

export default function Index() {
return <Redirect href="onboarding/signup" />
}
const [isOnBoardingSkipped, setIsOnBoardingSkipped] = useState<string>();

const _onLoad = async () => {
try {
const _isOnBoardingSkipped = await AsyncStorage.getItem(
IS_ONBOARDING_SKIPPED
);
setIsOnBoardingSkipped(_isOnBoardingSkipped);
} catch (e) {
console.log("Cannot get IS_ONBOARDING_SKIPPED", e);
}
};

useEffect(() => {
_onLoad();
}, []);

if (isOnBoardingSkipped === undefined) {
return <ActivityIndicator />;
}

if (isOnBoardingSkipped !== "true") {
return <Redirect href="onboarding/signup" />;
}

return <Redirect href={"onboarding/game-selection"} />;
}
85 changes: 70 additions & 15 deletions app/onboarding/signup.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,73 @@
import { Link, Stack } from "expo-router";
import { StatusBar } from "expo-status-bar";
import { StyleSheet, Text, View } from "react-native";
import { Stack, useNavigation } from "expo-router";
import { Image, StyleSheet, TouchableOpacity } from "react-native";
import Onboarding from "react-native-onboarding-swiper";
import Ionicons from "@expo/vector-icons/Ionicons";
import AsyncStorage from "@react-native-async-storage/async-storage";
import { IS_ONBOARDING_SKIPPED } from "../utils/storageKeys";

export default function Signup() {
const navigation = useNavigation();
const options = {
title: "Signup",
headerShown: false,
};

const onPressDone = async () => {
try {
await AsyncStorage.setItem(IS_ONBOARDING_SKIPPED, "true");
navigation.reset({
routes: [
{
name: "onboarding/game-selection",
},
],
});
} catch (e) {
console.log("Cannot set IS_NEW_USER to false", e);
}
};

return (
<View style={styles.container}>
<>
<Stack.Screen options={options} />
<Link style={styles.button} href="/onboarding/game-selection" asChild>
<Text>to game selection</Text>
</Link>
</View>
<Onboarding
showSkip={false}
bottomBarHighlight={false}
showNext={false}
pages={[
{
backgroundColor: "#202020",
subtitle: "Welcome to QLASH Community App",
image: (
<Image
resizeMode="contain"
style={styles.image}
source={require("../../assets/logo.png")}
/>
),
},
{
backgroundColor: "#202020",
title: "Engage",
subtitle: "Join the community and find new friends to play with",
},
{
backgroundColor: "#202020",
title: "Compete",
subtitle: "Enroll now in you favorite games competitions and win!",
},
]}
DoneButtonComponent={() => (
<TouchableOpacity onPress={onPressDone}>
<Ionicons
name="checkmark-circle"
style={styles.icon}
size={45}
color="#6d6d6d"
/>
</TouchableOpacity>
)}
/>
</>
);
}

Expand All @@ -24,10 +78,11 @@ const styles = StyleSheet.create({
alignItems: "center",
justifyContent: "center",
},
button: {
borderWidth: 1,
borderColor: 'black',
padding: 15,
borderRadius: 5,
}
image: {
width: 120,
height: 120,
},
icon: {
marginRight: 8,
},
});
1 change: 1 addition & 0 deletions app/utils/storageKeys.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const IS_ONBOARDING_SKIPPED = "@storage/isOnboardingSkipped";
Binary file added assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"web": "expo start --web"
},
"dependencies": {
"@react-native-async-storage/async-storage": "1.17.11",
"@types/react": "~18.0.27",
"expo": "~48.0.15",
"expo-constants": "~14.2.1",
Expand All @@ -18,6 +19,7 @@
"react": "18.2.0",
"react-dom": "18.2.0",
"react-native": "0.71.7",
"react-native-onboarding-swiper": "^1.2.0",
"react-native-safe-area-context": "4.5.0",
"react-native-screens": "~3.20.0",
"react-native-web": "~0.18.10"
Expand Down
4 changes: 3 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"compilerOptions": {},
"compilerOptions": {
"jsx": "react-jsx"
},
"extends": "expo/tsconfig.base"
}
Loading