Skip to content

Commit

Permalink
add title text input field to new request form
Browse files Browse the repository at this point in the history
  • Loading branch information
noahschutte committed Jul 31, 2016
1 parent 0e3baf7 commit c13d0f6
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 11 deletions.
31 changes: 31 additions & 0 deletions src/components/button.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React, { Component } from 'react';
import { Text, StyleSheet, TouchableHighlight } from 'react-native';

export default class Button extends Component {
render() {
return (
<TouchableHighlight style={styles.button} onPress={this.props.onPress}>
<Text style={styles.buttonText}>
{this.props.text}
</Text>
</TouchableHighlight>
);
}
};

const styles = StyleSheet.create({
button: {
justifyContent: 'center',
alignItems: 'center',
borderWidth: 1,
borderRadius: 5,
padding: 5,
borderColor: 'black',
marginTop: 10
},
buttonText: {
flex: 1,
alignSelf: 'center',
fontSize: 20
}
});
41 changes: 30 additions & 11 deletions src/components/new_request.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,29 @@
import React, { Component } from 'react';
import { View, Text, StyleSheet } from 'react-native';
import { View, Text, TextInput, StyleSheet } from 'react-native';
import Button from './button';

export default class NewRequest extends Component {
getInitialState() {
return {
title: '',
location: '',
pizzas: 0
}
}
render() {
return (
<View style={styles.container}>
<Text>
New Request Form
</Text>

<Text style={styles.label}>
Title:
</Text>
<TextInput
style={styles.input}
/>

</View>
);
}
Expand All @@ -18,16 +34,19 @@ const styles = StyleSheet.create({
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
backgroundColor: 'white',
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
label: {
fontSize: 18
},
input: {
padding: 4,
height: 40,
borderColor: 'gray',
borderWidth: 1,
borderRadius: 5,
margin: 5,
width: 200,
alignSelf: 'center'
}
});
5 changes: 5 additions & 0 deletions src/components/requests.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { Component } from 'react';
import { View, Text, StyleSheet } from 'react-native';
import Button from './button';

export default class Requests extends Component {
render() {
Expand All @@ -8,9 +9,13 @@ export default class Requests extends Component {
<Text>
Requests Page
</Text>
<Button text={'Create Request'} onPress={this.onNewRequestPress} />
</View>
);
}
onNewRequestPress() {
// this.props.navigator.push({name: 'new_request'});
}
};

const styles = StyleSheet.create({
Expand Down

0 comments on commit c13d0f6

Please sign in to comment.