-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.android.js
98 lines (83 loc) · 2.21 KB
/
index.android.js
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
88
89
90
91
92
93
94
95
96
97
98
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text, TextInput, TouchableOpacity,
View
} from 'react-native';
import {Navigation} from 'react-native-navigation';
import ChatScreen from './ChatScreen';
class react_native_navigation_bootstrap extends Component {
constructor(props) {
super(props);
this.state ={
name: 'name',
channel: 'channel'
}
}
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
What's your name?
</Text>
<TextInput
style={{height: 40, width: 200, borderWidth: 1, borderColor: 'grey', alignSelf: 'center'}}
onChangeText={(name) => this.setState({name})}
value={this.state.name}
/>
<Text style={styles.welcome}>
What channel do you want?
</Text>
<TextInput
style={{height: 40, width: 200, borderWidth: 1, borderColor: 'grey', alignSelf: 'center'}}
onChangeText={(channel) => this.setState({channel})}
value={this.state.channel}
/>
<TouchableOpacity onPress={() => this.startChat()}>
<Text style={[styles.welcome, {color: 'blue'}]}>
Chat!
</Text>
</TouchableOpacity>
</View>
);
}
startChat() {
this.props.navigator.push({
screen: 'chatScreen',
title: this.state.channel,
passProps: this.state
})
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});
Navigation.registerComponent('chatScreen', () => ChatScreen);
Navigation.registerComponent('react-native-navigation-bootstrap', () => react_native_navigation_bootstrap);
Navigation.startSingleScreenApp({
screen: {
screen: 'react-native-navigation-bootstrap',
title: 'Navigation Bootstrap'
}
});