-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
96 lines (86 loc) · 2.12 KB
/
App.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
import React from 'react';
import {
AppRegistry,
Text,
Button,
View,
Alert
} from 'react-native';
import { StackNavigator } from 'react-navigation';
//import './List.js'
// import ApiUtils from './ApiUtils'
class HomeScreen extends React.Component {
static navigationOptions = {
title: 'Welcome',
};
render() {
const { navigate } = this.props.navigation;
return (
<View>
<Text>Text app tag</Text>
<Button
onPress={() => navigate('Chat', { user: 'Tulasi Ram' })}
title="Chat with Ram"
/>
<Text>Dashboard !</Text>
<Button
onPress={() => navigate('Dashboard')}
title="Dashboard"
/>
</View>
);
}
}
class ChatScreen extends React.Component {
// Nav options can be defined as a function of the screen's props:
static navigationOptions = ({ navigation }) => ({
title: `Chat with ${navigation.state.params.user}`,
});
render() {
// The screen's current route is passed in to `props.navigation.state`:
const { params } = this.props.navigation.state;
return (
<View>
<Text>Chat with {params.user}</Text>
</View>
);
}
}
class DashboardScreen extends React.Component {
static navigationOptions = {
title: 'Dashboard Page',
};
render() {
const { navigate } = this.props.navigation;
return(
<View>
<Text> Dashboard Screen</Text>
<Button
onPress={() => navigate('List', {requestCount:'160'})}
title="Listing"
/>
</View>
);
}
}
class ListingScreen extends React.Component {
static navigationOptions = {
title: 'Listing page',
};
render() {
// const { navigate } = this.props.navigation
const {params} = this.props.navigation.state;
return (
<View>
<Text>Listing screen {params.requestCount}</Text>
</View>
);
}
}
const SimpleNavigation = StackNavigator({
Home: { screen: HomeScreen },
Chat: { screen: ChatScreen },
Dashboard: { screen: DashboardScreen },
List: { screen: ListingScreen },
});
AppRegistry.registerComponent('SimpleNavigation', () => SimpleNavigation);