-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSearchScreen.js
More file actions
87 lines (77 loc) · 1.79 KB
/
SearchScreen.js
File metadata and controls
87 lines (77 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/**
* Sample React Native App
* https://github.com/facebook/react-native
*/
'use strict';
var React = require('react-native');
var {
View,
Text,
TextInput,
StyleSheet,
} = React;
var ResultsScreen = require('./ResultsScreen');
// CMD+K for software keyboard in XCode Simulator
var SearchScreen = React.createClass({
gotoResultsScreen: function(searchPhrase) {
this.props.navigator.push({
title: 'Results',
component: ResultsScreen,
passProps: { 'searchPhrase': searchPhrase }
});
},
render: function() {
return (
<View style={styles.container}>
<Text style={styles.headline}>
Google Book Browser
</Text>
<Text style={styles.label}>
Find books containing:
</Text>
<TextInput
placeholder={this.props.placeholder}
returnKeyType='search'
enablesReturnKeyAutomatically={true}
onEndEditing={ event =>
this.gotoResultsScreen(event.nativeEvent.text)
}
style={styles.textInput} />
</View>
);
}
});
// reminder: Each JSX element needs to be styled directly
var styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center',
backgroundColor: Math.random() > 0.5 ? '#CC0066' : '#0099CC'
},
headline: {
fontFamily: 'Avenir Next',
fontSize: 30,
fontWeight: 'bold',
color: '#FFF',
marginBottom: 28
},
label: {
fontFamily: 'Avenir Next',
fontSize: 22,
fontWeight: 'normal',
color: '#FFF',
marginBottom: 8
},
textInput: {
borderColor: '#8D9996',
borderWidth: 0.5,
backgroundColor: '#FFF',
height: 40,
marginLeft: 60,
marginRight: 60,
padding: 8
}
});
module.exports = SearchScreen;