ldc-com-app/ComApp/src/App/Views/LoginScreen.js

54 lines
2.1 KiB
JavaScript
Raw Normal View History

2022-10-05 18:03:52 +02:00
import React from 'react';
import { View, ImageBackground, TextInput, Button, Image } from 'react-native';
// Common Styles
import commonStyles from '../../Resources/CommonStyles';
// Style
import styles from '../../Resources/Styles/LoginStyle';
// Translations
import i18n from "../../I18n";
// FileSytem
import * as FileSystem from 'expo-file-system';
class LoginScreen extends React.Component {
state = {
login: '',
password: '',
};
render() {
return (
<ImageBackground source={{ uri: FileSystem.documentDirectory + 'BackgroundImage.png' }} style={commonStyles.background}>
<View style={styles.container}>
<Image source={{ uri: FileSystem.documentDirectory + 'SquaredLogo.png' }} style={styles.logo} />
<View>
<TextInput
style={styles.text}
placeholder={i18n.t('login_s.username')}
value={this.state.login}
onChangeText={text => this.setState({ login: text })}
autoCapitalize={'none'}
autoCorrect={false}
keyboardType={'email-address'}
/>
<TextInput
style={styles.text}
placeholder={i18n.t('login_s.password')}
value={this.state.password}
onChangeText={text => this.setState({ password: text })}
secureTextEntry={true}
autoCapitalize={'none'}
autoCorrect={false}
/>
<Button
title={i18n.t('global.login')}
onPress={() => this.login(this.state.login, this.state.password)}
color={'#ce3029'}
/>
</View>
</View>
</ImageBackground >
);
}
}
export default LoginScreen;