This repository has been archived by the owner on Jul 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 103
/
LoginScreen.js
96 lines (82 loc) · 2.9 KB
/
LoginScreen.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
'use strict';
var React = require('react-native');
var {
StyleSheet,
Text,
View,
TouchableOpacity,
Image,
Navigator,
} = React;
var UserActions = require('../Actions/UserActions');
var UserStore = require('../Stores/UserStore');
var Video = require('react-native-video');
var Modal = require('react-native-modal');
var LinearGradient = require('react-native-linear-gradient');
var UserActions = require('../Actions/UserActions');
var styles = require('./Styles');
var UserStoreSync = require('../Mixins/UserStoreSync');
var DeviceHeight = require('Dimensions').get('window').height;
var LoginScreen = React.createClass({
mixins: [UserStoreSync, Modal.Mixin],
login() {
UserActions.newFacebookSession();
},
afterUpdateUserFromStore() {
var user = UserStore.getState();
if (user.get('email')) {
this.props.navigator.replace({id: 'user-info'});
}
},
showModalTransition(transition) {
transition('opacity', {duration: 200, begin: 0, end: 1});
transition('height', {duration: 200, begin: DeviceHeight * 2, end: DeviceHeight});
},
hideModalTransition(transition) {
transition('height', {duration: 200, begin: DeviceHeight, end: DeviceHeight * 2, reset: true});
transition('opacity', {duration: 200, begin: 1, end: 0});
},
render() {
return (
<View style={styles.container}>
<Video source={{uri: "background"}}
style={styles.backgroundVideo}
rate={1} volume={1} muted={true}
resizeMode="cover" repeat={true} key="video1" />
<View style={styles.loginContainer}>
<TouchableOpacity onPress={this.login}>
<LinearGradient colors={['#4c669f', '#3b5998', '#192f6a']} style={styles.linearGradient}>
<Text style={styles.buttonText}>
Sign in with Facebook
</Text>
</LinearGradient>
</TouchableOpacity>
</View>
<View style={styles.footer}>
<TouchableOpacity onPress={this.openModal} style={styles.aboutButton}>
<Text style={styles.aboutButtonText}>
About this project
</Text>
</TouchableOpacity>
</View>
<Modal isVisible={this.state.isModalOpen}
onClose={this.closeModal}
backdropType="blur"
backdropBlur="light"
forceToFront={true}
customShowHandler={this.showModalTransition}
customHideHandler={this.hideModalTransition}
onPressBackdrop={this.closeModal}>
<Text style={styles.aboutTitle}>
Welcome to the about section!
</Text>
<Text style={styles.aboutBody}>
This is just for fun to use a modal, nothing fancy to see here. A big thanks
the react-native team for this wonderful tool!
</Text>
</Modal>
</View>
);
},
});
module.exports = LoginScreen;