diff --git a/app/login.tsx b/app/login.tsx
index cb8113c..501e82f 100644
--- a/app/login.tsx
+++ b/app/login.tsx
@@ -1,22 +1,46 @@
-import { View, Text } from 'react-native'
-import React, { useEffect } from 'react'
+import { View, Text, SafeAreaView, TextInput, Button} from 'react-native'
+import React, { useEffect, useState } from 'react'
import { useAuth } from './contexts/AuthContext'
import { Redirect } from 'expo-router';
+import { FontAwesome } from "@expo/vector-icons";
+import { Input } from '../components';
export default function login() {
+ const [email, setEmail] = useState("");
+ const [password, setPassword] = useState("")
const {authState, onLogin} = useAuth();
- useEffect(() => {
- login()
- }, [])
+ // const {authState, onLogin} = useAuth();
+ // useEffect(() => {
+ // login()
+ // }, [])
const login = async() => {
- onLogin!("test", "test");
+ await onLogin!(email, password);
}
+
+
return (
-
- login
-
-
- )
+
+
+ {authState?.authenticated &&
+ }
+ }
+ onChangeHandler={setEmail}
+ />
+ }
+ rightIcon={}
+ onChangeHandler={setPassword}
+ secure = {true}
+ />
+
+
+
+ );
}
\ No newline at end of file
diff --git a/components/index.jsx b/components/index.tsx
similarity index 79%
rename from components/index.jsx
rename to components/index.tsx
index 403df5a..871d5ce 100644
--- a/components/index.jsx
+++ b/components/index.tsx
@@ -6,10 +6,15 @@ import Welcome from "./home/Welcome/Welcome"
import Plus from "./common/plus/plus"
import SearchBar from "./common/searchBar/SearchBar"
+
+//login
+import Input from "./login/input"
+
export {
ExpenseItem,
Welcome,
Plus,
- SearchBar
+ SearchBar,
+ Input,
}
diff --git a/components/login/input.tsx b/components/login/input.tsx
new file mode 100644
index 0000000..6e6ec48
--- /dev/null
+++ b/components/login/input.tsx
@@ -0,0 +1,85 @@
+import React from 'react';
+import {View, Text, TextInput, StyleSheet} from 'react-native';
+import { NativeSyntheticEvent } from 'react-native/Libraries/Types/CoreEventTypes';
+import { TextInputEndEditingEventData } from 'react-native/Libraries/Components/TextInput/TextInput';
+
+interface InputProps {
+ label? : string,
+ outlined? : boolean,
+ placeholder?: string,
+ leftIcon?: any,
+ rightIcon?: any,
+ numLines?: number,
+ onChangeHandler?: (text: string)=>void,
+ secure?: boolean,
+ validate?: (e : NativeSyntheticEvent)=>void, // ob die line "gecheckt" werden soll
+ errorMessage? : any, //error msg
+ errorColor?: string,
+ bgColor?: string,
+}
+
+function Input({
+ label,
+ outlined,
+ placeholder,
+ leftIcon,
+ rightIcon,
+ numLines,
+ onChangeHandler,
+ secure,
+ validate,
+ errorMessage,
+ errorColor,
+ bgColor
+} : InputProps) {
+ const containerBorder = outlined ? styles.outlined : styles.standard
+ if(numLines == undefined){
+ numLines = 1
+ }
+ return (
+
+ {label}
+
+ {leftIcon}
+
+ 1 ? true : false}
+ numberOfLines={numLines}
+ style={{flex: 4}}
+ />
+ {rightIcon}
+
+ {errorMessage}
+
+
+ )
+}
+
+const styles = StyleSheet.create({
+ label: {
+ fontWeight: '500',
+ },
+ container: {
+ padding: 10,
+ flexDirection: 'row',
+ alignItems: 'center',
+ backgroundColor: 'white'
+ },
+ outlined: {
+ borderColor: 'darkgrey',
+ borderRadius: 4,
+ borderWidth: 1,
+ },
+ standard: {
+ borderBottomColor: 'darkgrey',
+ borderBottomWidth: 1,
+ },
+
+})
+
+export default Input;
\ No newline at end of file