Advertisement
Guest User

Untitled

a guest
Sep 11th, 2016
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. import React, { Component } from 'react';
  2. import {
  3. StyleSheet,
  4. Text,
  5. TextInput,
  6. View
  7. } from 'react-native';
  8. import Button from './Components/Button'
  9.  
  10.  
  11. export default class SignIn extends Component {
  12. constructor(props) {
  13. super(props)
  14. this.state = {
  15. username: '',
  16. password: ''
  17. }
  18. }
  19. render() {
  20. return (
  21. <View style={styles.container}>
  22. <Text>Sign In</Text>
  23. <Text style={styles.label}>Username: </Text>
  24. <TextInput
  25. style={styles.input}
  26. onChangeText={(username) => this.setState({ username: username }) }
  27. placeholder="Enter Username..."
  28. value={this.state.username} />
  29. <Text style={styles.label}>Password: </Text>
  30. <TextInput
  31. style={styles.input}
  32. secureTextEntry={true}
  33. onChangeText={(password) => this.setState({ password }) }
  34. placeholder="Enter password..."
  35. value={this.state.password} />
  36. <Button text={'Sign In'} onPress={this.onPress() }/>
  37. </View>
  38. );
  39. }
  40. onPress() {
  41. this.setState = {
  42. password: ''
  43. }
  44. }
  45. }
  46.  
  47. var styles = StyleSheet.create({
  48. container: {
  49. flex: 1,
  50. justifyContent: 'center',
  51. alignItems: 'center'
  52. },
  53. input: {
  54. height: 40,
  55. padding: 4,
  56. borderColor: 'gray',
  57. borderWidth: 1,
  58. borderRadius: 5,
  59. margin: 5,
  60. width: 200,
  61. alignSelf: 'center'
  62. },
  63. label: {
  64. fontSize: 18
  65. }
  66. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement