Commit b4c8f105 authored by Malsha Rathnasiri's avatar Malsha Rathnasiri

fix keyboard overlap issue

parent 3c541e56
...@@ -3,7 +3,7 @@ import { StyleSheet, TextInput, Button, Image, Dimensions, View, Text, ActivityI ...@@ -3,7 +3,7 @@ import { StyleSheet, TextInput, Button, Image, Dimensions, View, Text, ActivityI
import EditScreenInfo from '../components/EditScreenInfo'; import EditScreenInfo from '../components/EditScreenInfo';
// import { Text, View } from '../components/Themed'; // import { Text, View } from '../components/Themed';
import { TouchableOpacity } from 'react-native'; import { TouchableOpacity } from 'react-native';
import { Toast } from 'native-base'; import { ScrollView, Toast } from 'native-base';
import { ERROR_TOAST_PROPS } from '../util/util'; import { ERROR_TOAST_PROPS } from '../util/util';
import { screenWidth, styles } from '../util/styles'; import { screenWidth, styles } from '../util/styles';
import TTS_logo from '../assets/images/TTS_logo.jpeg' import TTS_logo from '../assets/images/TTS_logo.jpeg'
...@@ -31,7 +31,7 @@ const LoginForm = ({ onLogin, navigation }) => { ...@@ -31,7 +31,7 @@ const LoginForm = ({ onLogin, navigation }) => {
} }
return ( return (
<View> <View >
<TextInput style={styles.input} <TextInput style={styles.input}
defaultValue={username} defaultValue={username}
onChangeText={(e) => { onChangeText={(e) => {
...@@ -61,11 +61,11 @@ const LoginForm = ({ onLogin, navigation }) => { ...@@ -61,11 +61,11 @@ const LoginForm = ({ onLogin, navigation }) => {
<TouchableOpacity style={styles.buttonContainer} <TouchableOpacity style={styles.buttonContainer}
// onPress={onButtonPress} // onPress={onButtonPress}
// disabled={!username || !password} // disabled={!username || !password}
onPress={onSubmit} onPress={onSubmit}
disabled={loading} disabled={loading}
>{loading ? <ActivityIndicator /> : <Text style={styles.buttonText}>LOGIN</Text> } >{loading ? <ActivityIndicator /> : <Text style={styles.buttonText}>LOGIN</Text>}
</TouchableOpacity> </TouchableOpacity>
</View> </View>
// define your styles // define your styles
...@@ -74,7 +74,7 @@ const LoginForm = ({ onLogin, navigation }) => { ...@@ -74,7 +74,7 @@ const LoginForm = ({ onLogin, navigation }) => {
export const LoginScreen = ({ onLogin, navigation }) => { export const LoginScreen = ({ onLogin, navigation }) => {
return ( return (
<View style={styles.loginScreenContainer}> <ScrollView style={styles.loginScreenContainer}>
<View style={{ alignContent: 'center', justifyContent: 'center' }}> <View style={{ alignContent: 'center', justifyContent: 'center' }}>
<Image source={TTS_logo} style={{ height: screenWidth - 30, width: screenWidth - 30, margin: 'auto' }} /> <Image source={TTS_logo} style={{ height: screenWidth - 30, width: screenWidth - 30, margin: 'auto' }} />
</View> </View>
...@@ -89,15 +89,10 @@ export const LoginScreen = ({ onLogin, navigation }) => { ...@@ -89,15 +89,10 @@ export const LoginScreen = ({ onLogin, navigation }) => {
<Text style={{ textAlign: 'center' }}>Don't have an account? </Text> <Text style={{ textAlign: 'center' }}>Don't have an account? </Text>
<Text style={{ fontWeight: 'bold', textAlign: 'center', }} onPress={() => navigation.replace('Signup')}>Sign up</Text> <Text style={{ fontWeight: 'bold', textAlign: 'center', }} onPress={() => navigation.replace('Signup')}>Sign up</Text>
</View> </View>
<View style={styles.loginContainer}>
{/* r<Image resizeMode="contain" style={styles.logo} source={require('../../components/images/logo-dark-bg.png')} /> */}
</View>
<View style={styles.formContainer}> <View style={styles.formContainer}>
<LoginForm onLogin={onLogin} /> <LoginForm onLogin={onLogin} />
</View> </View>
</View> </ScrollView>
); );
} }
\ No newline at end of file
import { StyleSheet, Dimensions } from "react-native" import { StyleSheet, Dimensions } from "react-native"
export const screenWidth = Dimensions.get('window').width export const screenWidth = Dimensions.get('window').width
export const screenHeight = Dimensions.get('window').height
export const PRIMARY_COLOR = '#2f95dc' export const PRIMARY_COLOR = '#2f95dc'
...@@ -16,7 +17,8 @@ export const styles = StyleSheet.create({ ...@@ -16,7 +17,8 @@ export const styles = StyleSheet.create({
loginContainer: { loginContainer: {
alignItems: 'center', alignItems: 'center',
flexGrow: 1, flexGrow: 1,
justifyContent: 'center' justifyContent: 'center',
backgroundColor: 'blue'
}, },
logo: { logo: {
position: 'absolute', position: 'absolute',
...@@ -25,7 +27,11 @@ export const styles = StyleSheet.create({ ...@@ -25,7 +27,11 @@ export const styles = StyleSheet.create({
}, },
loginScreenContainer: { loginScreenContainer: {
padding: 20, padding: 20,
backgroundColor: 'white' backgroundColor: 'white',
flex: 1,
},
formContainer: {
// backgroundColor: 'green'
}, },
input: { input: {
height: 40, height: 40,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment