From 6e63f868050aeb01e65141d5c9a62c09fd74bdf2 Mon Sep 17 00:00:00 2001 From: Keannu Bernasol Date: Wed, 11 Oct 2023 19:43:59 +0800 Subject: [PATCH] Added back button to create group and start studying pages and adding loading indicator for start studying --- src/icons/CaretLeftIcon/CaretLeftIcon.tsx | 28 +++++++++ src/routes/CreateGroup/CreateGroup.tsx | 30 ++++++---- src/routes/StartStudying/StartStudying.tsx | 68 ++++++++++++++-------- 3 files changed, 92 insertions(+), 34 deletions(-) create mode 100644 src/icons/CaretLeftIcon/CaretLeftIcon.tsx diff --git a/src/icons/CaretLeftIcon/CaretLeftIcon.tsx b/src/icons/CaretLeftIcon/CaretLeftIcon.tsx new file mode 100644 index 0000000..e2caaa5 --- /dev/null +++ b/src/icons/CaretLeftIcon/CaretLeftIcon.tsx @@ -0,0 +1,28 @@ +import * as React from "react"; +import { IconProps } from "../../interfaces/Interfaces"; +import { Svg, Path } from "react-native-svg"; +import { colors } from "../../styles"; + +export default function CaretLeftIcon(props: IconProps) { + return ( + <> + + + + + + ); +} diff --git a/src/routes/CreateGroup/CreateGroup.tsx b/src/routes/CreateGroup/CreateGroup.tsx index 0f4ec15..ac54d3d 100644 --- a/src/routes/CreateGroup/CreateGroup.tsx +++ b/src/routes/CreateGroup/CreateGroup.tsx @@ -6,6 +6,7 @@ import { TextInput, NativeSyntheticEvent, TextInputChangeEventData, + Pressable, } from "react-native"; import { useState } from "react"; import { @@ -22,6 +23,7 @@ import { urlProvider } from "../../components/Api/Api"; import MapView, { UrlTile, Marker } from "react-native-maps"; import { useNavigation } from "@react-navigation/native"; import { useToast } from "react-native-toast-notifications"; +import CaretLeftIcon from "../../icons/CaretLeftIcon/CaretLeftIcon"; export default function CreateGroup({ route }: any) { const { location, subject } = route.params; @@ -157,17 +159,23 @@ export default function CreateGroup({ route }: any) { }} /> - + + navigation.navigate("Home")}> + + + + + diff --git a/src/routes/StartStudying/StartStudying.tsx b/src/routes/StartStudying/StartStudying.tsx index 2aa8677..335d674 100644 --- a/src/routes/StartStudying/StartStudying.tsx +++ b/src/routes/StartStudying/StartStudying.tsx @@ -1,6 +1,12 @@ import * as React from "react"; import styles, { Viewport } from "../../styles"; -import { View, Text, ToastAndroid } from "react-native"; +import { + View, + Text, + ToastAndroid, + Pressable, + ActivityIndicator, +} from "react-native"; import { useState } from "react"; import { UserInfoReturnType, @@ -24,6 +30,7 @@ import { urlProvider } from "../../components/Api/Api"; import MapView, { UrlTile, Marker } from "react-native-maps"; import { useNavigation } from "@react-navigation/native"; import { useToast } from "react-native-toast-notifications"; +import CaretLeftIcon from "../../icons/CaretLeftIcon/CaretLeftIcon"; export default function StartStudying({ route }: any) { const { location } = route.params; @@ -90,6 +97,17 @@ export default function StartStudying({ route }: any) { }, }); + if (StudentInfo.isLoading) { + return ( + + + + + Loading... + + + ); + } if (location && location.coords) { return ( @@ -174,28 +192,32 @@ export default function StartStudying({ route }: any) { listMode="MODAL" /> - - + + navigation.navigate("Home")}> + + + + );