import React, {Component} from 'react'; import {Platform, StyleSheet, Text, View, Button, TextInput, Alert, Keyboard, ScrollView } from 'react-native'; import { createAppContainer, createStackNavigator, StackActions, NavigationActions } from 'react-navigation'; import KeyboardSpacer from 'react-native-keyboard-spacer'; export default class SignInScreen extends React.Component { //Functions constructor(props){ super(props) this.state = { password: '', username: '', } } _ValidateSignIn(){ //Validate: The username & password are correct. this.props.navigation.navigate('Main', {user: 'lilkhor'}); /*Keyboard.dismiss() if (this.state.username == '' || this.state.password == '') { alert("Please fill in all fields."); return; } else { fetch('http://compsci02.snc.edu/cs460/2019/khoral/mysql/authenticate_user.php', { method: 'POST', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', }, body: JSON.stringify({ name: this.state.username, password: this.state.password }) }).then((response) => response.json()) .then((responseJson) => { // Showing response message coming from server after inserting records. if (responseJson == "Success!") { Alert.alert("Welcome, " + this.state.username + "!"); this.props.navigation.navigate('Main'); } else{ Alert.alert(responseJson); return; } }).catch((error) => { console.error(error); }); }*/ } render() { return ( Sign In this.setState({username:text})} /> this.setState({password:text})} secureTextEntry={true} />