-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
157 lines (145 loc) · 3.93 KB
/
App.js
File metadata and controls
157 lines (145 loc) · 3.93 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
// import React, { Component } from 'react';
// import {View } from 'react-native';
// import FlatListComponent from './js/FlatListComponent'
// import SectionListComponent from './js/SectionListComponent'
// import ScrollViewTest from './js/scroviewTest'
// import DimensionsComponent from './js/FlexBoxComponent'
// import GridImageComponent from './js/GridImageComponent'
// import TextInputComponent from './js/TextInputComponent'
// import QQIogin from './js/QQIogin'
// import TouchableComponent from './js/TouchableComponent'
// import Touchables from './js/Touchables'
// import FetchData from './js/FetchData'
// import MyWeb from './js/WebView'
//
// export default class Setup extends Component {
// render() {
// return (
// <View style={{flex:1}}>
// {/*<MyWeb/>*/}
// </View>
// );
// }
//
// }
//
import React, {Component} from 'react';
import {
AppRegistry,
Text,
View,
Button,
WebView,
Image,
StyleSheet,
} from 'react-native';
import {StackNavigator,TabNavigator} from 'react-navigation';
//
// class ChatScreen extends Component {
// static navigationOptions = ({navigation}) => ({
// title: `Chat with ${navigation.state.params.user}`,
// });
//
// render() {
// const { params } = this.props.navigation.state;
// return (
// <View>
// <WebView
// source={{uri: 'https://github.com/facebook/react-native'}}
// style={{marginTop: 20,flex:1}}
// />
// </View>
// );
// }
// }
//
// class HomeScreen extends Component {
// static navigationOptions = {
// title: 'Welcome',
// };
//
// render() {
// const {navigate} = this.props.navigation;
// return (
// <View>
// <Text>Hello, chatApp!</Text>
// <Button onPress={() => navigate('Chat', {user: 'https://github.com/facebook/react-native'})} title="chat with lucy"></Button>
//
// </View>
// );
//
// }
// }
//
// const SimpleApp = StackNavigator({
// Home: {screen: HomeScreen},
// Chat: {screen: ChatScreen},
// });
class MyHomeScreen extends React.Component {
static navigationOptions = {
tabBarLabel: 'Home',
// Note: By default the icon is only shown on iOS. Search the showIcon option below.
tabBarIcon: ({ tintColor }) => (
<Image
source={require('./img/home.png')}
style={[styles.icon, {tintColor:tintColor}]}
/>
),
};
render() {
return (
<Button
onPress={() => this.props.navigation.navigate('Notifications')}
title="Go to notifications"
/>
);
}
}
class MyNotificationsScreen extends React.Component {
static navigationOptions = {
tabBarLabel: 'Notifications',
tabBarIcon: ({ tintColor }) => (
<Image
source={require('./img/notifications.png')}
style={[styles.icon,{tintColor:tintColor} ]}
/>
),
};
render() {
return (
<Button
onPress={() => this.props.navigation.goBack()}
title="Go back home"
/>
);
}
}
const styles = StyleSheet.create({
icon: {
width: 26,
height: 26,
},
});
const MyApp = TabNavigator(
{
Home: {
screen: MyHomeScreen,
},
Notifications: {
screen: MyNotificationsScreen,
},
},
{
tabBarOptions: {
activeTintColor: '#e91e63',
inactiveTintColor:'#979797',
showIcon: true,
style: {
backgroundColor: '#F3F3F3',
},
},
tabBarPosition:'bottom',
swipeEnabled:true
},
);
AppRegistry.registerComponent('ReactNativeTest', () => MyApp);