-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnavigation.js
More file actions
30 lines (28 loc) · 941 Bytes
/
navigation.js
File metadata and controls
30 lines (28 loc) · 941 Bytes
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
import React, { Component } from 'react';
import { Text, Navigator, TouchableHighlight } from 'react-native';
export default class Navigation extends Component {
render() {
const routes = [
{
title: 'First Scene',
index: 0
},
{
title: 'Second Scene',
index: 1
}
];
return (
<Navigator
initialRoute={routes[0]}
initialRouteStack={routes}
renderScene={
(route, navigator) =>
<TouchableHighlight
onPress={() => { if (route.index === 0) { navigator.push(routes[1]); } else { navigator.pop(); } } }>
<Text>Hello {route.title}!</Text>
</TouchableHighlight>}
style={{ padding: 200 }} />
);
}
}