diff --git a/App.tsx b/App.tsx
index f381c9b..92d2b63 100644
--- a/App.tsx
+++ b/App.tsx
@@ -24,6 +24,8 @@ import UserInfoPage from "./src/routes/UserInfoPage/UserInfoPage";
import SubjectsPage from "./src/routes/SubjectsPage/SubjectsPage";
import Loading from "./src/routes/Loading/Loading";
import StartStudying from "./src/routes/StartStudying/StartStudying";
+import { ToastProvider } from "react-native-toast-notifications";
+import AppIcon from "./src/icons/AppIcon/AppIcon";
const Drawer = createDrawerNavigator();
@@ -58,28 +60,30 @@ export default function App() {
}
}, [initialRoute]);
return (
-
-
-
+ }>
+
+
+
- }>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ }>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
);
}
diff --git a/package-lock.json b/package-lock.json
index 14006b9..e918be3 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -36,6 +36,7 @@
"react-native-screens": "~3.20.0",
"react-native-select-dropdown": "^3.3.4",
"react-native-svg": "13.4.0",
+ "react-native-toast-notifications": "^3.3.1",
"react-query": "^3.39.3",
"react-redux": "^8.1.1",
"redux": "^4.2.1"
@@ -12453,6 +12454,15 @@
"react-native": "*"
}
},
+ "node_modules/react-native-toast-notifications": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/react-native-toast-notifications/-/react-native-toast-notifications-3.3.1.tgz",
+ "integrity": "sha512-yc1Q2nOdIYvAf0GAIlmg8q42hiwpEHnLxkxJ6P+tN6jpcKZ1qzMXlgnmNdyF9cm9VOyHQexEP8952IKNAv1Olw==",
+ "peerDependencies": {
+ "react": "*",
+ "react-native": "*"
+ }
+ },
"node_modules/react-native/node_modules/promise": {
"version": "8.3.0",
"resolved": "https://registry.npmjs.org/promise/-/promise-8.3.0.tgz",
diff --git a/package.json b/package.json
index 5af9ec0..df97e93 100644
--- a/package.json
+++ b/package.json
@@ -37,6 +37,7 @@
"react-native-screens": "~3.20.0",
"react-native-select-dropdown": "^3.3.4",
"react-native-svg": "13.4.0",
+ "react-native-toast-notifications": "^3.3.1",
"react-query": "^3.39.3",
"react-redux": "^8.1.1",
"redux": "^4.2.1"
diff --git a/src/routes/Home/Home.tsx b/src/routes/Home/Home.tsx
index 0b79bae..aad9597 100644
--- a/src/routes/Home/Home.tsx
+++ b/src/routes/Home/Home.tsx
@@ -18,6 +18,7 @@ import {
urlProvider,
} from "../../components/Api/Api";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
+import { useToast } from "react-native-toast-notifications";
export default function Home() {
// Switch this condition to see the main map when debugging
@@ -29,6 +30,7 @@ export default function Home() {
"To continue, please allow Stud-E permission to location services"
);
const queryClient = useQueryClient();
+ const toast = useToast();
const ustpCoords = {
latitude: 8.4857,
@@ -40,9 +42,14 @@ export default function Home() {
const { status } = await Location.requestForegroundPermissionsAsync();
if (status !== "granted") {
setFeedback("Allow location permissions to continue");
- ToastAndroid.show(
+ toast.show(
"Location permission was denied. Please allow in order to use StudE",
- ToastAndroid.SHORT
+ {
+ type: "warning",
+ placement: "bottom",
+ duration: 4000,
+ animationType: "slide-in",
+ }
);
return;
}
@@ -122,16 +129,20 @@ export default function Home() {
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ["user"] });
queryClient.invalidateQueries({ queryKey: ["user_status"] });
- ToastAndroid.show(
- "You are no longer studying " + subject,
- ToastAndroid.SHORT
- );
+ toast.show("You are no longer studying " + subject, {
+ type: "success",
+ placement: "bottom",
+ duration: 4000,
+ animationType: "slide-in",
+ });
},
onError: () => {
- ToastAndroid.show(
- "Server error. Unable to update student status",
- ToastAndroid.SHORT
- );
+ toast.show("Server error. Unable to update student status", {
+ type: "warning",
+ placement: "bottom",
+ duration: 4000,
+ animationType: "slide-in",
+ });
},
});
function CustomCallout() {
@@ -139,7 +150,7 @@ export default function Home() {
if (studying) {
return (
-
+
You are here {"\n"}
X: {Math.round(location.coords.longitude) + "\n"}
Z: {Math.round(location.coords.latitude) + "\n"}
diff --git a/src/routes/Login/Login.tsx b/src/routes/Login/Login.tsx
index 8789fad..5050439 100644
--- a/src/routes/Login/Login.tsx
+++ b/src/routes/Login/Login.tsx
@@ -23,6 +23,7 @@ import {
setOnboarding,
unsetOnboarding,
} from "../../features/redux/slices/StatusSlice/StatusSlice";
+import { useToast } from "react-native-toast-notifications";
export default function Login() {
const navigation = useNavigation();
@@ -31,7 +32,7 @@ export default function Login() {
username: "",
password: "",
});
- const [error, setError] = useState("");
+ const toast = useToast();
return (
@@ -66,8 +67,6 @@ export default function Login() {
setCreds({ ...creds, password: e.nativeEvent.text });
}}
/>
-
- {error}