Created
July 24, 2018 04:17
-
-
Save antonderegt/517ebcf86a9a5a02f648566f62533cd6 to your computer and use it in GitHub Desktop.
Step-by-Step Guide To Create Sign Forms With React Native And Firebase 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import { | |
StyleSheet, | |
Text, | |
View, | |
TextInput, | |
Button | |
} from 'react-native'; | |
export default class App extends Component{ | |
constructor(props) { | |
super(props); | |
this.state = { | |
firstName: 'Thomas', | |
lastName: 'Ranger', | |
signature: '' | |
}; | |
} | |
render() { | |
return ( | |
<View style={styles.container}> | |
<Text style={styles.title}> | |
Sell your SOUL to the devil | |
</Text> | |
<Text style={styles.text}> | |
All you have to do is sign here | |
</Text><Text></Text><Text></Text> | |
<View style={styles.form}> | |
<Text style={styles.formText}> | |
First Name | |
</Text> | |
<TextInput | |
style={styles.textInput} | |
onChangeText={(firstName) => this.setState({firstName})} | |
value={this.state.firstName} | |
/> | |
<Text style={styles.formText}> | |
Last Name | |
</Text> | |
<TextInput | |
style={styles.textInput} | |
onChangeText={(lastName) => this.setState({lastName})} | |
value={this.state.lastName} | |
/> | |
<Text style={styles.formText}> | |
Signature | |
</Text> | |
<TextInput | |
style={styles.signatureInput} | |
onChangeText={(signature) => this.setState({signature})} | |
value={this.state.signature} | |
multiline = {true} | |
/> | |
<Button | |
onPress={()=>console.log('Pressed')} | |
title="SELL IT" | |
color="#841584" | |
/> | |
</View> | |
</View> | |
); | |
} | |
} | |
const styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
justifyContent: 'center', | |
alignItems: 'center', | |
backgroundColor: '#F5FCFF', | |
}, | |
title: { | |
fontSize: 30, | |
textAlign: 'center', | |
margin: 10, | |
}, | |
text: { | |
textAlign: 'left', | |
color: '#333333', | |
marginBottom: 5, | |
}, | |
form: { | |
width: '65%', | |
backgroundColor: '#F5FCFF', | |
}, | |
formText: { | |
fontWeight: 'bold' | |
}, | |
textInput: { | |
textAlign: 'left', | |
color: '#333333', | |
backgroundColor: '#FFF', | |
marginBottom: 5, | |
}, | |
signatureInput: { | |
textAlign: 'left', | |
color: '#333333', | |
backgroundColor: '#FFF', | |
marginBottom: 5, | |
height: 60 | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment