From d0853f7e0bed863ca2557b72d2d6cf9f9847225d Mon Sep 17 00:00:00 2001 From: Andrea Magnussen Date: Mon, 14 Jun 2021 15:06:53 +0200 Subject: [PATCH 01/10] Commented the components --- components/AccountData.js | 11 +++++++++++ components/CustomActivityIndicator.js | 14 ++++++++++++++ components/CustomButton.js | 14 ++++++++++++++ components/CustomCamera.js | 8 ++++++++ components/CustomDialog.js | 14 ++++++++++++++ components/CustomDropDown.js | 13 +++++++++++++ components/CustomHeader.js | 10 ++++++++++ components/CustomImagePicker.js | 11 ++++++++++- components/CustomRadioButtonGroup.js | 12 ++++++++++++ components/CustomTouchableOpacity.js | 11 +++++++++++ components/EditUserHeader.js | 9 +++++++++ components/ImagePreview.js | 8 ++++++++ components/ManageSalamanderCard.js | 14 ++++++++++++++ components/ManageUser.js | 15 +++++++++++++++ components/MatchResponse.js | 15 +++++++++++++++ components/PendingUser.js | 11 +++++++++++ components/SalamanderData.js | 11 +++++++++++ 17 files changed, 200 insertions(+), 1 deletion(-) diff --git a/components/AccountData.js b/components/AccountData.js index 4ac66cd..ccfd121 100644 --- a/components/AccountData.js +++ b/components/AccountData.js @@ -1,6 +1,17 @@ import React from "react"; import { StyleSheet, Text, View } from "react-native"; +/** + * This component simply shows a user's data. This is used in the ChangeNameScreen component and + * the ChangeEmailScreen component. + * + * @param {String} props.currentLabel - bolded text to show label for current + * @param {String} props.current - text to show current data + * @param {String} props.newLabel - text to show label for new + * + * @returns the component + */ + const AccountData = (props) => { return ( diff --git a/components/CustomActivityIndicator.js b/components/CustomActivityIndicator.js index cdc300e..8d87231 100644 --- a/components/CustomActivityIndicator.js +++ b/components/CustomActivityIndicator.js @@ -2,6 +2,20 @@ import React from 'react' import { StyleSheet, View, Modal, Text } from 'react-native' import { Colors, ActivityIndicator } from "react-native-paper"; +/** + * This component is used in screens where there are newtwork requests. This can be done better in the + * future, but its purpose is to prevent the user from aborting their task until they have received a response, + * and to prevent them from spamming a request. It is also used to visualize that the server is working. + * + * @param {Boolean} props.visible - this is the prop that makes the indicator visible or not. + * @param {Object} props.style - the style can be passed down to this component to customize it. + * @param {String} props.text - optional feature where a text can be passed to the component to + * indicate that it is processing something. Currently only used when + * image processing, since it takes some time. + * + * @returns the component + */ + const CustomActivityIndicator = (props) => { return ( diff --git a/components/CustomButton.js b/components/CustomButton.js index 98f06b2..1d2caf7 100644 --- a/components/CustomButton.js +++ b/components/CustomButton.js @@ -2,6 +2,20 @@ import * as React from "react"; import { Button } from "react-native-paper"; import { StyleSheet } from "react-native"; +/** + * A customizable component, that renders a button styled by the react native paper library. + * + * @param {Object} props.style - (Optional) can override the default style of the button where necessary, like size and position + * @param {String} props.color - (Optional) color of the button + * @param {IconSource} props.icon - (Optional) Icon to display for the button + * @param {String} props.mode - Mode/emphasis of the button. The modes outlined and contained have mostly been used. + * @param {Function} props.onPress - function that is run when the button the pressed (gets passed down from the mother component in this case) + * @param {Boolean} props.disabled - Whether the button is disabled. + * @param {String} props.title - The text on the button + * + * @returns the component + */ + const CustomButton = (props) => (