Login Page With Background Image
import React from 'react';
import { StyleSheet, View, Text, TouchableOpacity, ImageBackground } from 'react-native';
import { TextInput, Button } from 'react-native-paper';
export default function App() {
return (
<ImageBackground
source={{
uri: 'https://images.unsplash.com/photo-1514064019862-23e2a332a6a6?q=80&w=3114&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D',
}}
style={styles.container}
resizeMode="cover"
>
<View style={styles.overlay}>
<Text style={styles.header}>Welcome Back</Text>
<Text style={styles.subHeader}>Please log in to continue</Text>
<View style={styles.inputContainer}>
<TextInput
style={styles.input}
placeholder="Email"
keyboardType="email-address"
/>
<TextInput
style={styles.input}
placeholder="Password"
secureTextEntry
/>
</View>
<Button
mode="contained"
style={styles.loginButton}
onPress={() => console.log('Logged in')}
>
Log In
</Button>
<TouchableOpacity style={styles.forgotPassword}>
<Text style={styles.forgotPasswordText}>Forgot Password?</Text>
</TouchableOpacity>
<View style={styles.registerContainer}>
<Text style={styles.registerText}>Don't have an account? </Text>
<TouchableOpacity onPress={() => console.log('Navigate to Sign Up')}>
<Text style={styles.registerLink}>Sign Up</Text>
</TouchableOpacity>
</View>
</View>
</ImageBackground>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
paddingHorizontal: 20,
},
overlay: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
width: '100%',
borderRadius: 10,
padding: 20,
},
header: {
fontSize: 30,
fontWeight: 'bold',
color: 'white',
marginBottom: 10,
},
subHeader: {
fontSize: 16,
color: 'white',
marginBottom: 30,
},
inputContainer: {
width: '100%',
marginBottom: 20,
},
input: {
backgroundColor: 'white',
marginBottom: 15,
},
loginButton: {
backgroundColor: '#6200ea',
width: '100%',
paddingVertical: 10,
borderRadius: 5,
},
forgotPassword: {
marginTop: 15,
},
forgotPasswordText: {
color: 'white',
fontSize: 14,
textDecorationLine: 'underline',
},
registerContainer: {
flexDirection: 'row',
marginTop: 20,
},
registerText: {
color: 'white',
fontSize: 14,
},
registerLink: {
color: 'white',
fontSize: 14,
fontWeight: 'bold',
},
});
See More