diff --git a/components/Button/index.js b/components/Button/index.js index 9fc057561..bf29dfcbb 100644 --- a/components/Button/index.js +++ b/components/Button/index.js @@ -1,25 +1,49 @@ +import PropTypes from 'prop-types'; import * as React from 'react'; -import { Button } from 'react-native-paper'; +import { Button as PaperButton } from 'react-native-paper'; import { layout, theme } from '../../modules/theme'; -export default function PaperButton({ - onPressEvent, buttonText, - mode, compact, icon, disabled, loading, +const colorStyle = { + primary: theme.colors.primary, + accent: theme.colors.accent, + empty: theme.colors.placeholder, + black: theme.colors.black +}; + +const Button = ({ + onPress, buttonText, + mode, compact, icon, disabled, loading, color, style -}) { - return ( - - ); -} +}) => ( + + {buttonText} + +); + +Button.defaultProps = { + color: 'primary', + icon: '', + disabled: false, + loading: false +}; + +Button.propTypes = { + color: PropTypes.oneOf(['primary', 'accent', 'empty', 'black']), + icon: PropTypes.string, + disabled: PropTypes.bool, + loading: PropTypes.bool, + onPress: PropTypes.func.isRequired +}; + +export default Button; diff --git a/components/FormikFields/PaperInputPicker/Geolocation/index.js b/components/FormikFields/PaperInputPicker/Geolocation/index.js index f24d7ee2a..b8420fc46 100644 --- a/components/FormikFields/PaperInputPicker/Geolocation/index.js +++ b/components/FormikFields/PaperInputPicker/Geolocation/index.js @@ -48,14 +48,14 @@ const Geolocation = ({ errors, formikKey, setFieldValue }) => { {location === null && ( )} {location !== null && ( diff --git a/context/auth.context.js b/context/auth.context.js index e58588317..3d7a765b6 100644 --- a/context/auth.context.js +++ b/context/auth.context.js @@ -82,12 +82,12 @@ export const UserContextProvider = ({ children }) => { * @returns User Object */ - const register = async (params) => { + const register = async (params, notificationType) => { const { password } = params; storeData(password, 'password'); setIsLoading(true); try { - const u = await retrieveSignUpFunction(params); + const u = await retrieveSignUpFunction(params, notificationType); setUser(u); setError(null); setIsLoading(false); diff --git a/domains/Auth/SignUp/index.js b/domains/Auth/SignUp/index.js index abf067f46..d34bdc3ad 100644 --- a/domains/Auth/SignUp/index.js +++ b/domains/Auth/SignUp/index.js @@ -1,5 +1,5 @@ import { Formik } from 'formik'; -import React, { useContext } from 'react'; +import React, { useContext, useState } from 'react'; import { ActivityIndicator, KeyboardAvoidingView, @@ -10,10 +10,11 @@ import { } from 'react-native'; import { ScrollView } from 'react-native-gesture-handler'; import { - Button, Checkbox, Text + Checkbox, Text } from 'react-native-paper'; import * as yup from 'yup'; +import Button from '../../../components/Button'; import FormInput from '../../../components/FormikFields/FormInput'; import Autofill from '../../../components/FormikFields/PaperInputPicker/AutoFill'; import TermsModal from '../../../components/TermsModal'; @@ -56,13 +57,12 @@ const validationSchema = yup.object().shape({ // export default () => ( export default function SignUp({ navigation }) { - const [checked, setChecked] = React.useState(false); - const [visible, setVisible] = React.useState(false); - const [scrollViewScroll, setScrollViewScroll] = React.useState(); + const [checked, setChecked] = useState(false); + const [visible, setVisible] = useState(false); + const [scrollViewScroll, setScrollViewScroll] = useState(); + const [notificationType, setNotificationType] = useState('email'); + const { register } = useContext(UserContext); - const handleLogIn = () => { - navigation.navigate('Sign In'); - }; return ( - + + +