Advertisement
Guest User

Untitled

a guest
Jul 26th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.71 KB | None | 0 0
  1.  
  2. 'use strict';
  3.  
  4. import React, { Component } from 'react';
  5. import { connect } from 'react-redux';
  6. import { DeviceEventEmitter, Dimensions, Image, Text, AsyncStorage, TouchableOpacity } from 'react-native';
  7. import { Col, Row, Grid } from 'react-native-easy-grid';
  8. import { Container, Content, InputGroup, Input, Button, Icon, View } from 'native-base';
  9. import { replaceRoute } from '../../actions/route';
  10.  
  11. class Login extends Component {
  12.  
  13. constructor(props) {
  14. super(props);
  15. this.state = {
  16. visibleHeight: Dimensions.get('window').height,
  17. scroll: false,
  18. user: null,
  19. username: null
  20. };
  21. }
  22.  
  23. replaceRoute(route) {
  24. this.props.replaceRoute(route);
  25. }
  26.  
  27. loginWithEmail() {
  28.  
  29. }
  30.  
  31. loginWithFacebook() {
  32.  
  33. }
  34.  
  35. loginWithGoogle() {
  36.  
  37. }
  38.  
  39. render() {
  40. var _this=this;
  41. return (
  42. <Image style={{flex: 1, width: null, height: null }} resizeMode={Image.resizeMode.stretch} source={require('../../../images/splash.png')}>
  43. <Grid>
  44. <Col style={{ flex: 10 }} />
  45. <Col style={{ flex: 80 }}>
  46. <Row style={{ flex: 30 }} />
  47. <Row style={{ flex: 8 }}>
  48. <Image style={{ flex: 1, width: null, height: null }} resizeMode={Image.resizeMode.stretch} source={require('../../../images/logo.png') } />
  49. </Row>
  50. <Row style={{ flex: 3 }} />
  51. <Row style={{ flex: 40 }}>
  52. <Image style={{ flex: 1, width: null, height: null }} resizeMode={Image.resizeMode.stretch} source={ require('../../../images/login_overlay.png') }>
  53. <Grid>
  54. <Col style={{ flex: 5 }} />
  55. <Col style={{ flex: 90 }}>
  56. <Row style={{ flex: 2 }} />
  57. <Row style={{ flex: 15 }}>
  58. <InputGroup style={{flex: 1, width: null}}>
  59. <Icon name="ios-at" />
  60. <Input
  61. onChangeText={(text) => this.setState({ email: text })}
  62. value={this.state.email}
  63. controlled={true}
  64. keyboardType="email-address"
  65. placeholder="EMAIL"
  66. placeholderTextColor="#555555" />
  67. </InputGroup>
  68. </Row>
  69. <Row style={{ flex: 15 }}>
  70. <InputGroup style={{flex: 1, width: null}}>
  71. <Icon name="ios-key" />
  72. <Input
  73. onChangeText={(text) => this.setState({ password: text })}
  74. value={this.state.password}
  75. controlled={true}
  76. placeholder="PASSWORD"
  77. placeholderTextColor="#555555"
  78. secureTextEntry={true}/>
  79. </InputGroup>
  80. </Row>
  81. <Row style={{ flex: 5 }} />
  82. <Row style={{ flex: 15 }}>
  83. <Button block small success style={{flex: 1, width: null}} onPress={this.loginWithEmail.bind(this)}>
  84. <Text style={{fontWeight: 'bold', color: 'white'}}>LOG IN</Text>
  85. </Button>
  86. </Row>
  87.  
  88. <Row style={{ flex: 5, justifyContent: 'center' }}>
  89. <Text style={{fontWeight: 'bold', color: '#555555'}}> OR </Text>
  90. </Row>
  91. <Row style={{ flex: 15 }}>
  92. <View style={{flex: 1, flexDirection: 'row', alignItems: 'center', justifyContent:'center'}}>
  93. <View style={{flex: 15}} />
  94. <TouchableOpacity style={{flex: 1, width: 40, height:40}} onPress={this.loginWithFacebook.bind(this)}>
  95. <Image style={{width: 40, height: 40}} source={ require('../../../images/facebook.png') }/>
  96. </TouchableOpacity>
  97. <View style={{flex: 1}} />
  98. <TouchableOpacity style={{flex: 1, width: 40, height:40}} onPress={this.loginWithGoogle.bind(this)}>
  99. <Image style={{width: 40, height: 40}} source={ require('../../../images/google.png') }/>
  100. </TouchableOpacity>
  101. <View style={{flex: 14}} />
  102. </View>
  103. </Row>
  104. <Row style={{ flex: 1 }} />
  105. </Col>
  106. <Col style={{ flex: 5 }} />
  107. </Grid>
  108. </Image>
  109. </Row>
  110. <Row style={{ flex: 24 }} />
  111. <Row style={{ flexDirection: 'row', flex: 5 }}>
  112. <View style={{ flex: 1 }}/>
  113. <TouchableOpacity onPress={() => this.replaceRoute('register')}>
  114. <Text style={{fontWeight: 'bold', color: '#FFFFFF'}}>REGISTER</Text>
  115. </TouchableOpacity>
  116. <View style={{ flex: 20 }}/>
  117. <TouchableOpacity onPress={() => this.replaceRoute('welcome')}>
  118. <Text style={{fontWeight: 'bold', color: '#FFFFFF'}}>LATER</Text>
  119. </TouchableOpacity>
  120. <View style={{ flex: 1 }}/>
  121. </Row>
  122. <Row style={{ flex:1 }} />
  123. </Col>
  124. <Col style={{ flex: 10 }} />
  125. </Grid>
  126. </Image>
  127. );
  128. }
  129. }
  130.  
  131.  
  132.  
  133. function bindActions(dispatch){
  134. return {
  135. replaceRoute:(route)=>dispatch(replaceRoute(route))
  136. }
  137. }
  138.  
  139. export default connect(null, bindActions)(Login);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement