Skip to content

Instantly share code, notes, and snippets.

@akulsr0
Last active May 12, 2023 11:56
Show Gist options
  • Save akulsr0/d8c12b3546ea84ef2f4f349e0f1738e3 to your computer and use it in GitHub Desktop.
Save akulsr0/d8c12b3546ea84ef2f4f349e0f1738e3 to your computer and use it in GitHub Desktop.
React Native UI App - Login Screen 4
import React from 'react';
import {
StyleSheet,
Text,
View,
Image,
TextInput,
TouchableOpacity,
TouchableWithoutFeedback,
Dimensions,
Keyboard,
} from 'react-native';
// You can use your custom background image
import BackgroundImage from '../../assets/uiscreens/loginscreen4bg.jpeg';
// expo install expo-font
import { useFonts } from 'expo-font';
// https://fonts.google.com/specimen/Source+Sans+Pro
import SourceSansProLight from '../../assets/fonts/SourceSansPro/SourceSansProLight.ttf';
import SourceSansProRegular from '../../assets/fonts/SourceSansPro/SourceSansProRegular.ttf';
import SourceSansProBold from '../../assets/fonts/SourceSansPro/SourceSansProBold.ttf';
// npm install react-native-elements
import { Icon } from 'react-native-elements';
// npm install react-native-animatable
import * as Animatable from 'react-native-animatable';
export default function LoginScreen4() {
const [loaded] = useFonts({
SourceSansProLight,
SourceSansProRegular,
SourceSansProBold,
});
if (!loaded || !BackgroundImage) {
return <Text>Loading...</Text>;
}
return (
<TouchableWithoutFeedback onPress={() => Keyboard.dismiss()}>
<View style={styles.container}>
<View style={{ flex: 1 }}>
<Image
style={{ flex: 1, width: null, marginTop: -500 }}
source={BackgroundImage}
/>
</View>
<Animatable.Text
style={styles.titleText}
animation='fadeInUp'
delay={1200}
>
Travello
</Animatable.Text>
<View style={styles.bottomView}>
<Text style={styles.loginText}>Login</Text>
<View style={styles.inputView}>
<Icon
style={styles.inputIcon}
name='person'
type='ionicons'
color='#5352ed'
/>
<TextInput
style={styles.input}
placeholder='Username'
autoCapitalize='none'
keyboardType='email-address'
textContentType='emailAddress'
/>
</View>
<View style={styles.inputView}>
<Icon
style={styles.inputIcon}
name='lock'
type='ionicons'
color='#5352ed'
/>
<TextInput
style={styles.input}
placeholder='Password'
secureTextEntry={true}
autoCapitalize='none'
/>
</View>
<Text style={styles.fpText}>Forgot Password?</Text>
<TouchableOpacity style={styles.loginButton}>
<Text style={styles.loginButtonText}>Login</Text>
</TouchableOpacity>
<Text style={styles.registerText}>
Don't have an account?
<Text style={{ color: '#5352ed', fontFamily: 'SourceSansProBold' }}>
{' Register'}
</Text>
</Text>
</View>
</View>
</TouchableWithoutFeedback>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
},
titleText: {
position: 'absolute',
top: Dimensions.get('screen').height * 0.1,
alignSelf: 'center',
color: '#fff',
fontFamily: 'SourceSansProBold',
fontSize: 60,
shadowColor: '#000',
shadowOffset: {
width: 0,
height: 8,
},
shadowOpacity: 0.44,
shadowRadius: 10.32,
elevation: 16,
},
bottomView: {
backgroundColor: '#fff',
opacity: 0.95,
position: 'absolute',
bottom: 0,
left: 0,
right: 0,
borderTopLeftRadius: 30,
borderTopRightRadius: 30,
paddingTop: 10,
paddingBottom: 20,
paddingHorizontal: 20,
},
loginText: {
fontFamily: 'SourceSansProBold',
fontSize: 24,
marginTop: 12,
marginBottom: 4,
},
inputView: {
height: 40,
borderRadius: 10,
backgroundColor: '#f1f3f6',
marginTop: 10,
display: 'flex',
flexDirection: 'row',
alignItems: 'center',
},
inputIcon: {
paddingHorizontal: 8,
},
input: {
height: 40,
flex: 1,
fontFamily: 'SourceSansProRegular',
fontSize: 16,
color: '#333',
},
loginButton: {
backgroundColor: '#5352ed',
paddingVertical: 10,
borderRadius: 8,
marginTop: 10,
},
loginButtonText: {
color: '#fff',
fontFamily: 'SourceSansProBold',
alignSelf: 'center',
fontSize: 18,
},
registerText: {
alignSelf: 'center',
marginTop: 12,
fontFamily: 'SourceSansProRegular',
fontSize: 16,
},
fpText: {
marginTop: 10,
alignSelf: 'flex-end',
fontFamily: 'SourceSansProBold',
fontSize: 16,
color: '#5352ed',
},
});
Copy link

ghost commented Dec 6, 2021

good

@muhammed222-lab
Copy link

Great 👌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment