Advertisement
Guest User

Untitled

a guest
Jul 15th, 2018
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.35 KB | None | 0 0
  1.  
  2. export default class LoginLayout extends Component {
  3. constructor(props) {
  4. super(props);
  5. this.state = {
  6. username: '',
  7. password: ''
  8. };
  9. }
  10.  
  11.  
  12. render() {
  13. return (
  14. <View style={styles.formContainer}>
  15. <LoginInput placeholder='Username'
  16. iconName={'user-circle'}
  17. iconSource={'FontAwesome'}
  18. secureTextEntry={false}
  19. onChangeText={this.onChangeUsername}
  20. onSubmitEditing={() => this.passwordInput.focus()}
  21. autoCorrect={false}
  22. autoCapitalize="none"
  23. returnKeyType='next' />
  24.  
  25. <LoginInput placeholder='Password'
  26. iconName={'lock'}
  27. iconSource={'FontAwesome'}
  28. secureTextEntry={true}
  29. onChangeText={this.onChangeUsername}
  30. onSubmitEditing={() => this.onSubmit}
  31. autoCorrect={false}
  32. autoCapitalize="none"
  33. returnKeyType='done'
  34. passRef={ref => this.passwordInput = ref}
  35. />
  36. {/*
  37. <TouchableOpacity style={this.state.disabled ? styles.buttonContainerDisabled : styles.buttonContainer} onPress={this.onSubmit} disabled={this.props.loggingIn}>
  38. <Text style={styles.buttonText}>LOGIN</Text>
  39. </TouchableOpacity> */}
  40. </View>
  41. );
  42. }
  43.  
  44. onChangeUsername = (text) => this.setState({username: text})
  45. onChangePassword = (text) => this.setState({password: text})
  46.  
  47. focusPassword = () => this.passwordInput.focus()
  48. setRef = (input) => this.passwordInput = input
  49.  
  50. onSubmit = () => {
  51.  
  52. this.props.login(this.state.username, this.state.password)
  53.  
  54. // //dispatch the prelogin action to update the "isLoggingIn/isFetching"
  55. // //display loading wheel while waiting for API call
  56. // //when api data fetched dispatch its result and stop loading
  57.  
  58.  
  59. // //this.props.navigate('App');
  60. };
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement