Browse Source

tab based app

Daniel Zlotin 7 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,17 +1,34 @@
1 1
 import React, { Component } from 'react';
2 2
 import { View, Text, Button } from 'react-native';
3 3
 
4
+import Navigation from 'react-native-navigation';
5
+
4 6
 export default class WelcomeScreen extends Component {
5 7
   render() {
6 8
     return (
7 9
       <View style={styles.root}>
8 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 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 34
 const styles = {