@@ -6,75 +6,71 @@ import {
66 ScrollView ,
77 TouchableOpacity ,
88} from 'react-native' ;
9- import { Navigator } from 'react-native-deprecated-custom-components'
9+ import { StackNavigator } from 'react-navigation' ;
1010import SimpleExample from './SimpleExample' ;
1111import ScrollableTabsExample from './ScrollableTabsExample' ;
1212import OverlayExample from './OverlayExample' ;
1313import FacebookExample from './FacebookExample' ;
1414import DynamicExample from './DynamicExample' ;
1515
16- export default React . createClass ( {
17- render ( ) {
18- return < Navigator
19- style = { { flex : 1 , } }
20- initialRoute = { { } }
21- renderScene = { this . renderScene }
22- /> ;
16+ const HomeScreen = React . createClass ( {
17+ navigationOptions : {
18+ title : 'Welcome' ,
2319 } ,
2420
25- renderScene ( route , nav ) {
26- switch ( route . id ) {
27- case 'simple' :
28- return < SimpleExample /> ;
29- case 'scrollable' :
30- return < ScrollableTabsExample /> ;
31- case 'overlay' :
32- return < OverlayExample /> ;
33- case 'facebook' :
34- return < FacebookExample /> ;
35- case 'dynamic' :
36- return < DynamicExample /> ;
37- default :
38- return < View style = { styles . container } >
39- < TouchableOpacity
40- style = { styles . button }
41- onPress = { ( ) => nav . push ( { id : 'simple' , } ) }
42- >
43- < Text > Simple example</ Text >
44- </ TouchableOpacity >
21+ render ( ) {
22+ const { navigate } = this . props . navigation ;
23+
24+ return < View style = { styles . container } >
25+ < TouchableOpacity
26+ style = { styles . button }
27+ onPress = { ( ) => navigate ( 'Simple' ) }
28+ >
29+ < Text > Simple example</ Text >
30+ </ TouchableOpacity >
4531
46- < TouchableOpacity
47- style = { styles . button }
48- onPress = { ( ) => nav . push ( { id : 'scrollable' , } ) }
49- >
50- < Text > Scrollable tabs example</ Text >
51- </ TouchableOpacity >
32+ < TouchableOpacity
33+ style = { styles . button }
34+ onPress = { ( ) => navigate ( 'Scrollable' ) }
35+ >
36+ < Text > Scrollable tabs example</ Text >
37+ </ TouchableOpacity >
5238
53- < TouchableOpacity
54- style = { styles . button }
55- onPress = { ( ) => nav . push ( { id : 'overlay' , } ) }
56- >
57- < Text > Overlay example</ Text >
58- </ TouchableOpacity >
39+ < TouchableOpacity
40+ style = { styles . button }
41+ onPress = { ( ) => navigate ( 'Overlay' ) }
42+ >
43+ < Text > Overlay example</ Text >
44+ </ TouchableOpacity >
5945
60- < TouchableOpacity
61- style = { styles . button }
62- onPress = { ( ) => nav . push ( { id : 'facebook' , } ) }
63- >
64- < Text > Facebook tabs example</ Text >
65- </ TouchableOpacity >
46+ < TouchableOpacity
47+ style = { styles . button }
48+ onPress = { ( ) => navigate ( 'Facebook' ) }
49+ >
50+ < Text > Facebook tabs example</ Text >
51+ </ TouchableOpacity >
6652
67- < TouchableOpacity
68- style = { styles . button }
69- onPress = { ( ) => nav . push ( { id : 'dynamic' , } ) }
70- >
71- < Text > Dynamic tabs example</ Text >
72- </ TouchableOpacity >
73- </ View > ;
74- }
53+ < TouchableOpacity
54+ style = { styles . button }
55+ onPress = { ( ) => navigate ( 'Dynamic' ) }
56+ >
57+ < Text > Dynamic tabs example</ Text >
58+ </ TouchableOpacity >
59+ </ View > ;
7560 } ,
7661} ) ;
7762
63+ const App = StackNavigator ( {
64+ Home : { screen : HomeScreen } ,
65+ Simple : { screen : SimpleExample } ,
66+ Scrollable : { screen : ScrollableTabsExample } ,
67+ Overlay : { screen : OverlayExample } ,
68+ Facebook : { screen : FacebookExample } ,
69+ Dynamic : { screen : DynamicExample } ,
70+ } ) ;
71+
72+ export default App ;
73+
7874const styles = StyleSheet . create ( {
7975 container : {
8076 flex : 1 ,
0 commit comments