Skip to content
Snippets Groups Projects
Commit 1fd36355 authored by Andrea Magnussen's avatar Andrea Magnussen
Browse files

Added documentation to constant files

parent d0853f7e
No related branches found
No related tags found
1 merge request!70Resolve "Add comments to all files"
import React from "react";
import { DefaultTheme } from "react-native-paper";
/**
* Defines the overall theme of the application. See https://callstack.github.io/react-native-paper/theming.html for more documentation.
*/
const theme = {
...DefaultTheme,
roundness: 2,
......
import React from "react";
/**
* Used for remembering if the user is logged in or not. It was a early way of doing it, it might be better to
* stick with using redux instead to handle which screens should be visible based on user status.
*/
export const AuthContext = React.createContext();
/**
* These constants are used for the restrictions and regexes throughout the application
*/
export const NAME_MAX_LENGTH = 40;
export const NUMBER_MAX_LENGTH = 15;
export const LOCATION_NUMBER_MAX_LENGTH = 4;
......
import React from 'react'
/**
* This file includes various toasts the user can get. More documentation on this: https://www.npmjs.com/package/react-native-toast-message
*/
import Toast from "react-native-toast-message";
/**
* Shows a toast/response message to the user that everything went well (statuscode 200).
*
* @param {String} pos - position of the toast
* @param {Integer} time - how long the toast should be visible
* @param {String} message - displays information to the user.
*/
export const toastSuccess = (pos, time, message) => {
Toast.show({
type: "success",
......@@ -11,6 +21,13 @@ export const toastSuccess = (pos, time, message) => {
});
}
/**
* Shows a toast/response message to the user that something went wrong (statuscode 4XX).
*
* @param {String} pos - position of the toast
* @param {Integer} time - how long the toast should be visible
* @param {String} message - displays information to the user.
*/
export const toastError = (pos, time, message) => {
Toast.show({
type: "error",
......@@ -21,6 +38,13 @@ export const toastError = (pos, time, message) => {
});
}
/**
* Shows a toast/response message that provides information to the user.
*
* @param {String} pos - position of the toast
* @param {Integer} time - how long the toast should be visible
* @param {String} message - displays information to the user.
*/
export const toastInfo = (pos, time, message) => {
Toast.show({
type: "info",
......@@ -31,6 +55,11 @@ export const toastInfo = (pos, time, message) => {
});
}
/**
* Will be displayed if the server is not responding/it failed before reaching the server.
*
* @param {Integer} statusCode - will provide different messages based on numerous status codes.
*/
export const toast500 = (statusCode) => {
let errorText = "";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment