From 6c939b1b8c20143ae281d4d1a39267217d86508e Mon Sep 17 00:00:00 2001 From: Ayush Srivastava Date: Thu, 16 Jun 2022 12:29:36 +0530 Subject: [PATCH] minor bug fixes --- App.js | 2 +- Components/AboutInfo.js | 242 +++---------------------------- Components/LogoutButton.js | 6 +- Navigation/AppNavigation.js | 25 ++-- Navigation/GrowMoreNavigation.js | 50 +------ Screens/CropList.js | 14 -- Screens/CropRecommender.js | 106 +++++++------- Screens/History.js | 50 ------- Screens/LoginPage.js | 169 ++++++++++----------- Screens/SignUpPage.js | 93 +++--------- Screens/StartingScreen.js | 39 ++--- 11 files changed, 222 insertions(+), 574 deletions(-) delete mode 100644 Screens/CropList.js delete mode 100644 Screens/History.js diff --git a/App.js b/App.js index 6df6863..2baddc4 100644 --- a/App.js +++ b/App.js @@ -6,7 +6,7 @@ import FlashMessage from "react-native-flash-message"; export default function App() { - global.baseURL = 'localhost:8081/' + return ( diff --git a/Components/AboutInfo.js b/Components/AboutInfo.js index 6a94ed6..0c87c3a 100644 --- a/Components/AboutInfo.js +++ b/Components/AboutInfo.js @@ -1,74 +1,30 @@ -import React, { useState } from "react"; +import React, { useState, useEffect, useCallback } from "react"; import { View, StyleSheet, Text, - Touchable, - TouchableOpacity, - FlatList, } from "react-native"; import { Divider } from "react-native-elements"; -import { useNavigation } from "@react-navigation/native"; +import AsyncStorage from "@react-native-async-storage/async-storage"; +import { FontAwesome } from "@expo/vector-icons"; -import { Entypo, FontAwesome } from "@expo/vector-icons"; - -import { LinearGradient } from "expo-linear-gradient"; -const AboutInfo = (props) => { - const navigation = useNavigation(); +const AboutInfo = () => { const [status, setStatus] = useState(true); - const [displayItems, setDisplayItems] = useState([]); - // console.log(displayItems); - - const randomData = [ - { - id: "1", - employer: "Crop: Maize", - position: "Farm 1", - from: "08/14/2020", - to: "09/14/2021", - }, - { - id: "2", - employer: "Crop: Wheat", - position: "Farm 2", - from: "08/14/2020", - to: "09/14/2021", - }, - { - id: "3", - employer: "Crop: Paddy", - position: "Farm 3", - from: "08/14/2020", - to: "09/14/2021", - }, - { - id: "4", - employer: "Crop: Banana", - position: "Farm 4", - from: "08/14/2020", - to: "09/14/2021", - }, - ]; - const DropDownOptions = [ - { - keyIndex: "1", - option: "Farm 1", - }, - { - keyIndex: "2", - option: "Farm 2", - }, - { - keyIndex: "3", - option: "Farm 3", - }, - { - keyIndex: "4", - option: "Farm 4", - }, - ]; - let name = "Srividya"; - let category = "Vijaywada, A.P"; + const [userData, setUserData] = useState({}); + + useEffect(() => { + getUserData(); + }, []) + + + const getUserData = useCallback(() => { + + AsyncStorage.getItem("userData").then((value) => { + let parseData = JSON.parse(value); + setUserData(parseData); + }); + + }, []) const username = (name) => { var str = name; @@ -81,55 +37,21 @@ const AboutInfo = (props) => { return res; }; - const handleDisplayList = (index, operation) => { - // console.log(index); - let temp = [...displayItems]; - switch (operation) { - case "add": - temp.push(index); - setDisplayItems(temp); - break; - case "delete": - const removeIndex = displayItems.findIndex( - (item) => item.keyIndex == index - ); - temp.splice(removeIndex, 1); - setDisplayItems([...temp]); - break; - default: - break; - } - }; - const DifferenceBetweenDates = (from, to) => { - let date1 = new Date(from); - let date2 = new Date(to); - let numberOfMonths = (date2.getFullYear() - date1.getFullYear()) * 12 + (date2.getMonth() - date1.getMonth()) + 1; - let numberOfYears = (numberOfMonths/12).toFixed(0); - let display = numberOfYears + (numberOfYears == '1'? ' year ':' years ') + numberOfMonths + (numberOfMonths == '1'? ' month':' months') - return(display); - } return ( - About You - navigation.navigate("DashboardEditProfile")} - > - Edit - - {status ? ( - {username(name)} + {username(userData.name)} ) : ( @@ -139,104 +61,11 @@ const AboutInfo = (props) => { - {name} - {category.toUpperCase()} + {userData.name} + {userData.email} - - - About - - Repaired and maintained fences, farm machineries, and farm buildings. -Executed and performed feeding and caring for farm animals like horses and cattle. -Drove and operated farm tractors to bush hog and make hay. -Harvested and reaped vegetables, fruits and crops using farm equipment or hand. -Repaired and replaced defective farm equipment. - - - {/* item.keyIndex} - renderItem={({ item }) => ( - - - {item.option} - {displayItems.indexOf(item.keyIndex) == -1 ? ( - handleDisplayList(item.keyIndex, "add")} - > - - - ) : ( - handleDisplayList(item.keyIndex, "delete")} - > - - - )} - - {displayItems.indexOf(item.keyIndex) != -1 ? ( - item.id} - renderItem={({ item }) => ( - - - - {item.position} - {item.employer} - - {DifferenceBetweenDates(item.from, item.to)} - - - - - - - )} - /> - ) : null} - - )} - /> */} - - - Show More - + ); }; @@ -271,28 +100,9 @@ const styles = StyleSheet.create({ fontSize: 18, }, - mainContainer: { - flexDirection: "row", - justifyContent: "space-between", - }, - - subHeading: { - padding: 10, - color: "grey", - }, - buttonCV: { - width: "50%", - alignSelf: "center", - }, - editButton: { - padding: 10, - color: "#FF0000", - }, - nameAndCat: { alignSelf: "center", justifyContent: "center", - // alignItems: 'center' }, name: { fontSize: 18, @@ -309,11 +119,7 @@ const styles = StyleSheet.create({ content: { padding: 10, }, - showMore: { - alignSelf: "center", - color: "#F02F39", - paddingVertical: 10, - }, + ProfilePicText: { fontSize: 40, color: "#DA9917", diff --git a/Components/LogoutButton.js b/Components/LogoutButton.js index 17f0352..66b1b33 100644 --- a/Components/LogoutButton.js +++ b/Components/LogoutButton.js @@ -10,7 +10,7 @@ export const LogoutButton = () => { const clearData = await AsyncStorage.clear(); AsyncStorage.getItem("userData").then((value) => { - let parseData = JSON.parse(value); + let parseData = JSON.parse(value); console.log(parseData); }) @@ -31,8 +31,8 @@ export const LogoutButton = () => { ); }; return ( - LogOutPressed()}> - Logout + LogOutPressed()}> + Logout ) } \ No newline at end of file diff --git a/Navigation/AppNavigation.js b/Navigation/AppNavigation.js index 1c00895..e9f25d3 100644 --- a/Navigation/AppNavigation.js +++ b/Navigation/AppNavigation.js @@ -1,23 +1,27 @@ -import React, { useState, useEffect, useMemo } from "react"; -import { SideDrawer, Auth, StackNav } from "./GrowMoreNavigation"; +import React, { useState, useCallback, useMemo, useEffect } from "react"; +import { Auth, StackNav } from "./GrowMoreNavigation"; import { NavigationContainer } from "@react-navigation/native"; -import StartingScreen from "../Screens/StartingScreen"; import { AuthContext } from "../Context"; import AsyncStorage from "@react-native-async-storage/async-storage"; export const AppNavigation = () => { const [storage, setStorage] = useState(); - const [isLoading, setIsloading] = useState(true); - console.log(storage) + useEffect(() => { - + getUserData(); + }, []) + + + const getUserData = useCallback(() => { + AsyncStorage.getItem("userData").then((value) => { let parseData = JSON.parse(value); setStorage(parseData); - + }); - }, []); + + }, []) const authContext = useMemo(() => { return { @@ -27,9 +31,6 @@ export const AppNavigation = () => { signUp: () => { setStorage("userSignup"); }, - skip: () => { - setStorage("skip"); - }, logOut: () => { setStorage(null); console.log('Logout') @@ -39,7 +40,7 @@ export const AppNavigation = () => { return ( - { storage ? : } + {storage ? : } ); diff --git a/Navigation/GrowMoreNavigation.js b/Navigation/GrowMoreNavigation.js index c42494d..c7e4685 100644 --- a/Navigation/GrowMoreNavigation.js +++ b/Navigation/GrowMoreNavigation.js @@ -1,31 +1,17 @@ -import React, { useState } from "react"; +import React from "react"; import { createStackNavigator } from "@react-navigation/stack"; import { createBottomTabNavigator } from "@react-navigation/bottom-tabs"; import { MaterialCommunityIcons } from "@expo/vector-icons"; -import { createDrawerNavigator } from "@react-navigation/drawer"; -import AsyncStorage from "@react-native-async-storage/async-storage"; import LoginPage from "../Screens/LoginPage"; import SignUpPage from "../Screens/SignUpPage"; import StartingScreen from "../Screens/StartingScreen"; import Dashboard from "../Screens/Dashboard"; import CropRecommender from "../Screens/CropRecommender"; import News from "../Screens/News"; -import CropList from "../Screens/CropList"; -import History from "../Screens/History"; -import { Alert } from "react-native"; -import { AuthContext } from "../Context"; -import WeatherFetch from "../Screens/WeatherFetch"; import { LogoutButton } from "../Components/LogoutButton"; const Authnavigator = createStackNavigator(); export const Auth = () => { - const [oldUser, setOldUser] = useState(); - AsyncStorage.getItem("checkUser").then((value) => { - let parseData = JSON.parse(value); - //let checkUserAccess = (!parseData) ? 'false" : "true" - setOldUser(parseData.olduser); - //console.log('oldeuser value ', parseData.olduser); - }); return ( @@ -69,25 +55,17 @@ export const TabNavigation = (props) => { tabBarIcon: ({ focused, color, size }) => { let iconName; if (route.name === "News") { - iconName = focused - ? "newspaper-variant" - : "newspaper-variant-outline"; + iconName = focused ? "newspaper-variant" : "newspaper-variant-outline"; } else if (route.name === "Recommender") { iconName = focused ? "thumb-up" : "thumb-up-outline"; - } else if (route.name === "CropList") { - iconName = focused - ? "format-list-bulleted-square" - : "format-list-text"; - } else if (route.name === "History") { - iconName = focused ? "history" : "history"; - } else if (route.name === "Dashboard") { + } else if (route.name === "Dashboard") { iconName = focused ? "view-dashboard" : "view-dashboard-outline"; } return ( ); @@ -114,15 +92,7 @@ export const TabNavigation = (props) => { headerTitleStyle: { color: "#fff" }, }} /> - + { headerTitleStyle: { color: "#fff" }, }} /> - + { - return ( - - - - ) -} - -export default CropList - -const styles = StyleSheet.create({}) diff --git a/Screens/CropRecommender.js b/Screens/CropRecommender.js index ca1986f..637cecb 100644 --- a/Screens/CropRecommender.js +++ b/Screens/CropRecommender.js @@ -1,4 +1,4 @@ -import React, { useState, useEffect } from 'react'; +import React, { useState, useEffect, useCallback } from 'react'; import { StyleSheet, Text, View, TextInput, TouchableWithoutFeedback, Keyboard, TouchableOpacity, FlatList, ActivityIndicator, ScrollView } from 'react-native' import Constants from "expo-constants"; import AsyncStorage from "@react-native-async-storage/async-storage"; @@ -17,13 +17,12 @@ const CropRecommender = ({ navigation }) => { const BASE_WEATHER_URL = "https://history.openweathermap.org/data/2.5/aggregated/month?"; const [userLocation, setUserLocation] = useState(); - const [autoWeatherFetch, setAutoWeatherFetch] = useState(false); const [weatherData, setWeatherData] = useState(null); const [loading, setLoading] = useState(false); const [visible, setVisible] = useState(false); const [formProgress, setFormProgress] = useState('soil'); const [cropVisible, setCropVisible] = useState(false) - const [accessToken, setAccessToken] = useState('') + const [accessToken, setAccessToken] = useState(''); //data states const [nitrogen, setNitrogen] = useState(''); @@ -35,28 +34,11 @@ const CropRecommender = ({ navigation }) => { const [humidity, setHumidity] = useState(''); const [predictedCrop, setPredictedCrop] = useState(null); - - // useEffect(() => { - // if(cropVisible !== null) - // { - - // } - // }, [predictedCrop]) - - // useEffect(() => { - - // AsyncStorage.getItem("userData").then((value) => { - // let parseData = JSON.parse(value); - // setAccessToken(parseData.accessToken); - - - // }); - // }, []); - useEffect(() => { - fetchLocation() + fetchLocation(); + getUserData(); }, []) - + useEffect(() => { if (weatherData !== null) { @@ -66,6 +48,7 @@ const CropRecommender = ({ navigation }) => { } }, [weatherData]) + const getWeatherData = async () => { setLoading('weatherFetching'); @@ -83,6 +66,16 @@ const CropRecommender = ({ navigation }) => { }); } + const getUserData = useCallback(() => { + + AsyncStorage.getItem("userData").then((value) => { + let parseData = JSON.parse(value); + setAccessToken(parseData.token); + }); + + }, []) + + const submit = () => { if (!nitrogen) { showMessage({ @@ -116,42 +109,27 @@ const CropRecommender = ({ navigation }) => { setLoading('toWeather'); setTimeout(() => { setLoading(false); - // setFormProgress('weather') setVisible(true); - // navigation.navigate('WeatherFetch') }, 200); } } - // const AutoWeatherFetch = () =>{ - // setLoading('weatherFetching'); - // setAutoWeatherFetch(true); - // } - const fetchLocation = async () => { - + if (Platform.OS === 'android' && !Constants.isDevice) { - setErrorMsg( - 'Oops, this will not work on Snack in an Android emulator. Try it on your device!' - ); + console.warn("Oops, location fetching doesn't work on Android emulator. Try it on your device!") return; } let { status } = await Location.requestForegroundPermissionsAsync(); if (status !== 'granted') { - setErrorMsg('Permission to access location was denied'); + alert('Permission to access location was denied'); return; } let location = await Location.getCurrentPositionAsync({}); - // setLocation(location); setUserLocation(location.coords); - // setTimeout(() => { - // if (userLocation) { - - // } - // }, 200); } const goBack = () => { @@ -210,13 +188,13 @@ const CropRecommender = ({ navigation }) => { duration: 3500, }); } else { - - setLoading('predict') + + setLoading('predict') var myHeaders = new Headers(); myHeaders.append("Content-Type", "application/json"); var raw = JSON.stringify({ - "values": `${nitrogen}`+" "+`${phosphorus}`+" "+`${potassium}`+" "+`${temperature.toString()}`+" "+`${humidity.toString()}`+" "+`${pH}`+" "+`${rainfall.toString()}` + "values": `${nitrogen}` + " " + `${phosphorus}` + " " + `${potassium}` + " " + `${temperature.toString()}` + " " + `${humidity.toString()}` + " " + `${pH}` + " " + `${rainfall.toString()}` }); var requestOptions = { @@ -232,7 +210,8 @@ const CropRecommender = ({ navigation }) => { // alert() setPredictedCrop(result.prediction); setCropVisible(true); - setLoading(false) + setLoading(false); + }) .catch(error => console.log('error', error)); @@ -240,6 +219,36 @@ const CropRecommender = ({ navigation }) => { } + const saveHistory = () => { + var myHeaders = new Headers(); + myHeaders.append("Content-Type", "application/json"); + myHeaders.append("Authorization", `Bearer ${accessToken}`); + console.log(`Bearer ${accessToken}`) + + var raw = JSON.stringify({ + "details": [nitrogen, phosphorus, potassium, temperature.toString(), humidity.toString(), pH, rainfall.toString()], + "cropSuggested": predictedCrop + }); + console.log(raw) + + var requestOptions = { + method: 'POST', + headers: myHeaders, + body: raw, + redirect: 'follow' + }; + + fetch("https://growmoreweb.herokuapp.com/v1/model/history", requestOptions) + .then((response) => { + // if (response.ok) + return response.json() + // else + // throw 'History API error : ' + response.status; + }) + .then(result => console.log(result)) + .catch(error => console.warn(error)); + } + const DisplaySwitch = () => { switch (formProgress) { case 'soil': @@ -380,12 +389,8 @@ const CropRecommender = ({ navigation }) => { } return ( - // - // {autoWeatherFetch && } - // - {/* {autoWeatherFetch && } */} @@ -443,7 +448,6 @@ const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: '#fff', - // marginTop: Constants.statusBarHeight }, heading: { color: '#36454f', @@ -457,7 +461,6 @@ const styles = StyleSheet.create({ paddingLeft: 15 }, fieldContainer: { - // alignItems: 'center' marginVertical: 30 }, label: { @@ -470,7 +473,6 @@ const styles = StyleSheet.create({ input: { backgroundColor: 'rgb(192,192,192)', width: '92%', - // marginVertical: 10, height: 55, borderRadius: 10, fontSize: 18, diff --git a/Screens/History.js b/Screens/History.js deleted file mode 100644 index 2ada4f7..0000000 --- a/Screens/History.js +++ /dev/null @@ -1,50 +0,0 @@ -import React, { useEffect, useState } from 'react' -import { StyleSheet, Text, View } from 'react-native' -import AsyncStorage from "@react-native-async-storage/async-storage"; - -const History = () => { - - const [accessToken, setAccessToken] = useState('') - - useEffect(() => { - - AsyncStorage.getItem("userData").then((value) => { - let parseData = JSON.parse(value); - setAccessToken(parseData.accessToken); - - - }); - }, []); - - useEffect(() => { - if(accessToken !== ''){ - getHistoryAPI() - } - }, [accessToken]) - - const getHistoryAPI = () => { - var myHeaders = new Headers(); - myHeaders.append("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI2MWNjZjQ2Njk0YWM2MWU3N2ZjZWE4NmIiLCJ0eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjQwODUxMTYyLCJpYXQiOjE2NDA4MzY3NjJ9.Xufa6ZqHtRl819d6tkxB0LHKZOJVe7fF2TA2oiDrqeM"); - - var requestOptions = { - method: 'GET', - headers: myHeaders, - redirect: 'follow' - }; - - fetch("localhost:8081/v1/model/history/", requestOptions) - .then(response => response.text()) - .then(result => console.log(result)) - .catch(error => console.log('error', error)); - } - - return ( - - - - ) -} - -export default History - -const styles = StyleSheet.create({}) diff --git a/Screens/LoginPage.js b/Screens/LoginPage.js index 721668b..0783092 100644 --- a/Screens/LoginPage.js +++ b/Screens/LoginPage.js @@ -8,7 +8,8 @@ import { TouchableWithoutFeedback, Keyboard, KeyboardAvoidingView, - ActivityIndicator + ActivityIndicator, + ScrollView } from "react-native"; import { LinearGradient } from "expo-linear-gradient"; import { TouchableOpacity } from "react-native-gesture-handler"; @@ -23,14 +24,14 @@ const LoginPage = ({ navigation }) => { const [passHidden, setPassHidden] = useState(true); const [loading, setLoading] = useState(); const { login } = React.useContext(AuthContext); - const { skip } = React.useContext(AuthContext); - const saveDataToStorage = (loginStatus, accessToken) => { - AsyncStorage.setItem( + const saveDataToStorage = async (userName, userEmail, accessToken) => { + await AsyncStorage.setItem( "userData", - JSON.stringify({ Status: loginStatus, name: accessToken }) + JSON.stringify({ name: userName, email: userEmail, token: accessToken, Status: 'success' }) ); }; + const SubmitLogin = () => { if (!loginID) { showMessage({ @@ -47,6 +48,7 @@ const LoginPage = ({ navigation }) => { duration: 3500, }); } else { + setLoading(true); var myHeaders = new Headers(); myHeaders.append("Content-Type", "application/json"); @@ -54,7 +56,6 @@ const LoginPage = ({ navigation }) => { "email": loginID, "password": password }); - console.log(raw) var requestOptions = { method: 'POST', @@ -63,21 +64,27 @@ const LoginPage = ({ navigation }) => { redirect: 'follow' }; - fetch("https://grow-more-backend.herokuapp.com/v1/auth/login", requestOptions) - .then((response) => response.json()) - .then((result) => { - if (result.user !== undefined) { + fetch("https://growmoreweb.herokuapp.com/v1/auth/login", requestOptions) + .then((response) => { + if (response.ok) + return response.json() + else + throw 'SignUp API error : ' + response.status; + }) + .then((result) => { + showMessage({ message: "Logged In Successfully !", type: "success", icon: "success", duration: 3500, }); - saveDataToStorage("name", result.user.name) + saveDataToStorage(result.user.name, result.user.email, result.tokens.access.token) login() - } + }) - .catch(error => console.log('error', error)); + .finally(() => setLoading(false)) + .catch(error => console.warn(error)); } }; @@ -85,74 +92,72 @@ const LoginPage = ({ navigation }) => { - - - - + + + - - Login - - Email - setLoginID(text)} - value={loginID} - keyboardAppearance={'dark'} - autoCapitalize="none" + - Password - - - setPassword(text)} - value={password} - autoCapitalize="none" - /> - setPassHidden(!passHidden)} - > - + Login + + Email + setLoginID(text)} + value={loginID} + keyboardAppearance={'dark'} + autoCapitalize="none" + /> + Password + + + setPassword(text)} + value={password} + autoCapitalize="none" /> - + setPassHidden(!passHidden)} + > + + + + - - Forgot Password? + SubmitLogin()} + > + {loading ? ( + + ) : ( + Login + )} - SubmitLogin()} - > - {loading ? ( - - ) : ( - Login - )} - - - - + + + Don't have an account? { const [name, setName] = useState(""); - const [username, setUsername] = useState(""); const [password, setPassword] = useState(""); const [email, setEmail] = useState("") const [passHidden, setPassHidden] = useState(true); const [loading, setLoading] = useState(); const { login } = React.useContext(AuthContext); - const { skip } = React.useContext(AuthContext); - const saveDataToStorage = (loginStatus, accessToken) => { - AsyncStorage.setItem( + const saveDataToStorage = async (userName, userEmail, accessToken) => { + await AsyncStorage.setItem( "userData", - JSON.stringify({ Status: loginStatus, name: accessToken }) + JSON.stringify({ name: userName, email: userEmail, token: accessToken, Status: 'success' }) ); }; const SubmitSignUp = () => { @@ -57,45 +55,14 @@ const SignUpPage = ({ navigation }) => { duration: 3500, }); } else { - // setLoading(true) - // var myHeaders = new Headers(); - // myHeaders.append("Content-Type", "application/json"); - - // var raw = JSON.stringify({ - // name: (name), - // email: (email), - // password: (password) - // }); - - // var requestOptions = { - // method: 'POST', - // headers: myHeaders, - // body: raw, - // // redirect: 'follow' - // }; - - // fetch(global.baseURL+"v1/auth/register", requestOptions) - // .then(response => response.json()) - // .then(result => { - // console.log(result); - // showMessage({ - // message: "Signed Up Successfully !", - // type: "success", - // icon: "success", - // duration: 3500, - // }); - // saveDataToStorage("success", result.tokens.access.token) - // login() - // }) - // .finally(() => setLoading(false)) - // .catch(error => console.log('error', error)); + setLoading(true) var myHeaders = new Headers(); myHeaders.append("Content-Type", "application/json"); var raw = JSON.stringify({ - "name": (name), - "email": (email), - "password": (password) + "name": name, + "email": email, + "password": password }); var requestOptions = { @@ -105,27 +72,28 @@ const SignUpPage = ({ navigation }) => { redirect: 'follow' }; - fetch("https://grow-more-backend.herokuapp.com/v1/auth/register", requestOptions) - .then(response => { - if (!response.ok) { - alert("Something went wrong"); - } - return response.text() + + fetch("https://growmoreweb.herokuapp.com/v1/auth/register", requestOptions) + .then((response) => { + if (response.ok) + return response.json(); + else + throw 'SignUp API error : ' + response.status; }) .then(result => { - console.log(result); - if (result.user !== undefined) { + showMessage({ message: "Signed Up Successfully !", type: "success", icon: "success", duration: 3500, }); - saveDataToStorage("success", result.user.name) + saveDataToStorage(result.user.name, result.user.email, result.tokens.access.token) login() - } + }) - .catch(error => console.log('error', error)); + .finally(() => setLoading(false)) + .catch(error => console.warn(error)); } }; @@ -155,14 +123,7 @@ const SignUpPage = ({ navigation }) => { value={name} autoCapitalize="none" /> - {/* create username - setUsername(text)} - value={username} - autoCapitalize="none" - /> */} + your email { value={email} autoCapitalize="none" /> - Password + password { /> - {/* - Forgot Password? - */} + { - const [isLoading, setIsloading] = useState(true); - setTimeout(() => { - setIsloading(false); - }, 1000); - useEffect(() => { - setIsloading(true) - }, []) + return ( @@ -21,13 +15,11 @@ const StartingScreen = ({ navigation }) => { style={styles.logoImg} source={require("../assets/starting-banner.png")} /> - { - isLoading ? - : - navigation.navigate('LoginPage')}>Let's Get Started - } + + navigation.navigate('LoginPage')}> + Let's Get Started + + ); @@ -61,9 +53,7 @@ const styles = StyleSheet.create({ }, logoImg: { height: 350, - // flex:1, width: 350, - // marginVertical:'10%', alignSelf: 'center', resizeMode: "contain", }, @@ -71,16 +61,15 @@ const styles = StyleSheet.create({ padding: 12, borderRadius: 10, marginHorizontal: 10, + backgroundColor: '#5b8462', + marginTop:'20%', + elevation: 10, + shadowColor: '#000' + }, + buttonText:{ color: '#fff', fontSize: 20, textAlign: 'center', - backgroundColor: '#5b8462', - // marginTop:'20%' - // position:'absolute', - // bottom: 100 - // marginTop:140 - // shadowColor:'#fff', - // elevation:2 } })