Browse Source

tab based app

Daniel Zlotin 8 years ago
parent
commit
f26193dfa1
1 changed files with 20 additions and 3 deletions
  1. 20
    3
      playground/src/containers/WelcomeScreen.js

+ 20
- 3
playground/src/containers/WelcomeScreen.js View File

1
 import React, { Component } from 'react';
1
 import React, { Component } from 'react';
2
 import { View, Text, Button } from 'react-native';
2
 import { View, Text, Button } from 'react-native';
3
 
3
 
4
+import Navigation from 'react-native-navigation';
5
+
4
 export default class WelcomeScreen extends Component {
6
 export default class WelcomeScreen extends Component {
5
   render() {
7
   render() {
6
     return (
8
     return (
7
       <View style={styles.root}>
9
       <View style={styles.root}>
8
         <Text style={styles.h1}>{`React Native Navigation!`}</Text>
10
         <Text style={styles.h1}>{`React Native Navigation!`}</Text>
9
-        <Button>
10
-          <Text style={styles.h1}>{`Switch to tab based app`}</Text>
11
-        </Button>
11
+        <Button title="Switch to tab based app" onPress={this.onClickSwitchToTabs} />
12
       </View>
12
       </View>
13
     );
13
     );
14
   }
14
   }
15
+
16
+  onClickSwitchToTabs() {
17
+    Navigation.startApp({
18
+      tabs: [
19
+        {
20
+          container: {
21
+            name: 'com.example.SimpleTabScreen'
22
+          }
23
+        },
24
+        {
25
+          container: {
26
+            name: 'com.example.WelcomeScreen'
27
+          }
28
+        }
29
+      ]
30
+    });
31
+  }
15
 }
32
 }
16
 
33
 
17
 const styles = {
34
 const styles = {