From 951f68377d31807230fb991f45fdbb694dab9f6a Mon Sep 17 00:00:00 2001 From: Priyatham Sai chand Date: Fri, 1 Apr 2022 07:06:46 +0530 Subject: [PATCH] log in screen --- App.js | 5 +- android/app/src/main/AndroidManifest.xml | 2 +- components/BottomTab.js | 142 ++++++++++++----------- components/HomeScreen.js | 78 ++++++------- components/RegisterUserScreen.js | 139 ++++++++++++++++++++++ 5 files changed, 259 insertions(+), 107 deletions(-) create mode 100644 components/RegisterUserScreen.js diff --git a/App.js b/App.js index a38f70d..31d0db5 100644 --- a/App.js +++ b/App.js @@ -56,7 +56,10 @@ const App = () => { enableScreens(); return ( - + + + + ); diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 6c0febb..77b7586 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,6 +1,5 @@ - - ( - - - - - ) - - }}/> - ( - - - - - ) - - }}/> - ( - - - - - ) - - }}/> - ( - - - - - ) - - }}/> + screenOptions={{ + title: '', + tabBarShowLabel: false, + tabBarStyle: [ + { + position: 'absolute', + bottom: 10, + left: 20, + right: 20, + elevation: 0, + backgroundColor: '#cdcdcd', + borderRadius: 25, + height: 50, + width: '90%', + }, + ], + }}> + ( + + ), + headerShown:false, + }} + /> + ( + + ), + headerShown:false, + }} + /> + ( + + ), + headerShown:false, + }} + /> + ( + + ), + headerShown:false, + }} + /> ); } diff --git a/components/HomeScreen.js b/components/HomeScreen.js index e26ab9a..7e88397 100644 --- a/components/HomeScreen.js +++ b/components/HomeScreen.js @@ -1,53 +1,53 @@ import React from 'react'; import { - StatusBar, - StyleSheet, - Text, - useColorScheme, - View, + StatusBar, + StyleSheet, + Text, + useColorScheme, + View, } from 'react-native'; -import { Icon } from 'react-native-elements' +import { Icon } from 'react-native-elements'; const HomeScreen = () => { - return ( + return ( - <> - - - Rental - - - Home - - - - Key - - + <> + + + Rental + + + Home + + + + Key + + - - ); + + ); } const styles = StyleSheet.create({ - viewRoot: { - backgroundColor: '#fffff2', - height: '100%', - }, - heading: { - color: '#206ba5', - fontSize: 60, - textAlign: 'center', - marginTop: '40%', - fontFamily: 'Ubuntu-Bold', - }, - icon: { + viewRoot: { + backgroundColor: '#fffff2', + height: '100%', + }, + heading: { + color: '#206ba5', + fontSize: 60, + textAlign: 'center', + marginTop: '40%', + fontFamily: 'Ubuntu-Bold', + }, + icon: { - alignSelf: "flex-start", - marginLeft: '28%', - flexDirection: 'row', - }, + alignSelf: "flex-start", + marginLeft: '28%', + flexDirection: 'row', + }, }); export default HomeScreen; diff --git a/components/RegisterUserScreen.js b/components/RegisterUserScreen.js new file mode 100644 index 0000000..b9fa0af --- /dev/null +++ b/components/RegisterUserScreen.js @@ -0,0 +1,139 @@ +import React, {useState } from 'react'; +import { + StatusBar, + StyleSheet, + Text, + useColorScheme, + View, + TouchableHighlight, + TextInput +} from 'react-native'; +import { Icon } from 'react-native-elements'; + + +const RegisterUserScreen = () => { + + const [username, setUsername] = useState("") + const [orgname, setOrgname] = useState("") + const [token, setToken] = useState("none") + var [ isPress, setIsPress ] = useState(false); + + const register = () => { + var data = { + "username": username, + "orgName": orgname + } + fetch("http://192.168.29.141:4000/users", { + method: "POST", + headers: { + 'Accept': 'application/json', + 'Content-Type': 'application/json', + }, + body: JSON.stringify(data) + }) + .then(function (response) { + return response.json(); + }) + .then(function (data) { + console.log(data) + setToken(data) + }); + +} + + var touchProps = { + + activeOpacity: 1, + underlayColor: 'white', + style: isPress ? styles.btnPress : styles.btnNormal, + onHideUnderlay: () => setIsPress(false), + onShowUnderlay: () => setIsPress(true), + onPress: register, + } + + var textInputProps = { + style:styles.input, + onChangeText:setUsername, + value:username, + placeholder:"username", + placeholderTextColor : "#4b4a4a", + + } + return ( + + <> + + + Log In + + + + + + + + + + Submit + + + + {token.message} + + + + ); +} + +const styles = StyleSheet.create({ + viewRoot: { + backgroundColor: '#ffffff', + height: '100%', + justifyContent: 'center', + alignItems: 'center' + }, + heading: { + color: '#1C254E', + fontSize: 60, + textAlign: 'center', + fontFamily: 'Ubuntu-Bold', + }, + icon: { + + alignSelf: "flex-start", + marginLeft: '28%', + flexDirection: 'row', + }, + btnNormal: { + borderRadius: 10, + height: 45, + width: 140, + backgroundColor: '#1C254E', + alignItems: 'center', + justifyContent: 'center', + }, + btnText: { + textAlign: 'center', + fontSize: 22, + color:'white', + }, + btnPress: { + borderRadius: 10, + height: 45, + width: 140, + backgroundColor: '#1C254E', + justifyContent: 'center', + }, + input: { + height: 60, + width: 280, + margin: 12, + borderRadius: 15, + padding: 10, + color: "black", + backgroundColor: "#c4c4c4", + }, +}); + +export default RegisterUserScreen;