Guest User

Untitled

a guest
May 23rd, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. import React, { Component } from 'react';
  2. import {
  3. StyleSheet,
  4. View,
  5. } from 'react-native';
  6. import {
  7. Text,
  8. Item,
  9. Label,
  10. Input,
  11. Button,
  12. } from 'native-base';
  13. import firebase from './config'
  14. import Form from 'react-native-form'
  15.  
  16. export default class App extends Component{
  17. constructor(props) {
  18. super(props);
  19. this.state = {
  20. };
  21. this.itemsRef = firebase.database().ref().child(`people`)
  22. }
  23.  
  24. pushToFirebase() {
  25. let formValues = this.refs.soulForm.getValues()
  26. this.itemsRef.push(formValues)
  27. }
  28.  
  29. render() {
  30. return (
  31. <View style={styles.container}>
  32. <Text style={styles.title}>
  33. Sell your SOUL to the devil
  34. </Text>
  35. <Text style={styles.text}>
  36. All you have to do is sign here
  37. </Text><Text></Text><Text></Text>
  38. <Form ref="soulForm" style={styles.form} >
  39. <Item floatingLabel style={{marginTop:10}}>
  40. <Label style={{marginLeft: 15}}>First name</Label>
  41. <Input style={{marginLeft: 25}} name="firstName" type="TextInput" />
  42. </Item>
  43. <Item floatingLabel style={{marginTop:10}}>
  44. <Label style={{marginLeft: 15}}>Last name</Label>
  45. <Input style={{marginLeft: 25}} name="lastName" type="TextInput" />
  46. </Item>
  47. <Item floatingLabel style={{marginTop:10}}>
  48. <Label style={{marginLeft: 15}}>Signature</Label>
  49. <Input style={{marginLeft: 25}} name="signature" type="TextInput" />
  50. </Item>
  51. <Button Block primary onPress={() => this.pushToFirebase()} style={styles.button}><Text>Sell it</Text></Button>
  52. </Form>
  53. </View>
  54. );
  55. }
  56. }
  57.  
  58. const styles = StyleSheet.create({
  59. container: {
  60. flex: 1,
  61. justifyContent: 'center',
  62. alignItems: 'center',
  63. backgroundColor: '#F5FCFF',
  64. },
  65. title: {
  66. fontSize: 30,
  67. textAlign: 'center',
  68. margin: 10,
  69. },
  70. text: {
  71. textAlign: 'left',
  72. color: '#333333',
  73. marginBottom: 5,
  74. },
  75. form: {
  76. width: '80%'
  77. },
  78. button: {
  79. margin: 10
  80. }
  81. });
Add Comment
Please, Sign In to add comment