|
1 | | -/** |
2 | | - * Sample React Native App |
3 | | - * https://github.com/facebook/react-native |
4 | | - * @flow |
5 | | - */ |
6 | | - |
7 | 1 | import React, { Component } from 'react'; |
8 | 2 | import { |
9 | 3 | AppRegistry, |
10 | | - StyleSheet, |
11 | | - Text, |
12 | | - View |
13 | 4 | } from 'react-native'; |
| 5 | +import App from './src/App' |
| 6 | +import { StackNavigator } from 'react-navigation'; |
| 7 | +import SecondScreen from './src/SecondScreen' |
| 8 | + |
| 9 | +class reactNavigationSample extends Component { |
| 10 | + static navigationOptions = { |
| 11 | + title: 'Home Screen', |
| 12 | + }; |
| 13 | + |
| 14 | + render(){ |
| 15 | + const { navigation } = this.props; |
14 | 16 |
|
15 | | -export default class reactNavigationSample extends Component { |
16 | | - render() { |
17 | 17 | return ( |
18 | | - <View style={styles.container}> |
19 | | - <Text style={styles.welcome}> |
20 | | - Welcome to React Native! |
21 | | - </Text> |
22 | | - <Text style={styles.instructions}> |
23 | | - To get started, edit index.ios.js |
24 | | - </Text> |
25 | | - <Text style={styles.instructions}> |
26 | | - Press Cmd+R to reload,{'\n'} |
27 | | - Cmd+D or shake for dev menu |
28 | | - </Text> |
29 | | - </View> |
| 18 | + <App navigation={ navigation }/> |
30 | 19 | ); |
31 | 20 | } |
32 | 21 | } |
33 | 22 |
|
34 | | -const styles = StyleSheet.create({ |
35 | | - container: { |
36 | | - flex: 1, |
37 | | - justifyContent: 'center', |
38 | | - alignItems: 'center', |
39 | | - backgroundColor: '#F5FCFF', |
40 | | - }, |
41 | | - welcome: { |
42 | | - fontSize: 20, |
43 | | - textAlign: 'center', |
44 | | - margin: 10, |
45 | | - }, |
46 | | - instructions: { |
47 | | - textAlign: 'center', |
48 | | - color: '#333333', |
49 | | - marginBottom: 5, |
50 | | - }, |
| 23 | +const SimpleApp = StackNavigator({ |
| 24 | + Home: { screen: reactNavigationSample }, |
| 25 | + SecondScreen: { screen: SecondScreen, title: 'ss' }, |
51 | 26 | }); |
52 | 27 |
|
53 | | -AppRegistry.registerComponent('reactNavigationSample', () => reactNavigationSample); |
| 28 | +AppRegistry.registerComponent('reactNavigationSample', () => SimpleApp); |
0 commit comments