Browse Source

Initial implementation

Guy Carmeli 8 years ago
parent
commit
4f6f7ef4b3

+ 66
- 66
example-redux/src/app.js View File

@@ -35,74 +35,74 @@ export default class App {
35 35
   startApp(root) {
36 36
     switch (root) {
37 37
       case 'login':
38
-        // Navigation.startSingleScreenApp({
39
-        //  screen: {
40
-        //    screen: 'example.LoginScreen',
41
-        //    title: 'Login',
42
-        //    navigatorStyle: {}
43
-        //  },
44
-        //  passProps: {
45
-        //    str: 'This is a prop passed in \'startSingleScreenApp()\'!',
46
-        //    obj: {
47
-        //      str: 'This is a prop passed in an object!',
48
-        //      arr: [
49
-        //        {
50
-        //          str: 'This is a prop in an object in an array in an object!'
51
-        //        }
52
-        //      ],
53
-        //      arr2: [
54
-        //        [
55
-        //          'array of strings',
56
-        //          'with two strings'
57
-        //        ],
58
-        //        [
59
-        //          1, 2, 3
60
-        //        ]
61
-        //      ]
62
-        //    },
63
-        //    num: 1234,
64
-        //    fn: function() {
65
-        //      return 'Hello from a function!';
66
-        //    }
67
-        //  }
68
-        // });
69 38
         Navigation.startSingleScreenApp({
70
-          screen: {
71
-            screen: 'example.FirstTabScreen',
72
-            title: 'Login',
73
-            topTabs: [
74
-              {
75
-                screenId: 'example.FirstTabScreen',
76
-                title: 'Tab1',
77
-                passProps: {
78
-                  str: 'This is a prop passed to Tab4',
79
-                  fn: () => 'Hello from a function passed as passProps!'
80
-                }
81
-              },
82
-              {
83
-                screenId: 'example.PushedScreen',
84
-                title: 'Tab3',
85
-                passProps: {
86
-                  str: 'This is a prop passed to Tab2'
87
-                }
88
-              },
89
-              {
90
-                screenId: 'example.ListScreen',
91
-                title: 'Tab2',
92
-                passProps: {
93
-                  str: 'This is a prop passed to Tab1'
94
-                }
95
-              }
96
-            ],
97
-            navigatorStyle: {}
98
-          },
99
-          drawer: { // optional, add this if you want a side menu drawer in your app
100
-            left: { // optional, define if you want a drawer from the left
101
-              screen: 'example.SideMenu' // unique ID registered with Navigation.registerScreen
102
-            },
103
-            disableOpenGesture: false // optional, can the drawer be opened with a swipe instead of button
104
-          }
39
+         screen: {
40
+           screen: 'example.LoginScreen',
41
+           title: 'Login',
42
+           navigatorStyle: {}
43
+         },
44
+         passProps: {
45
+           str: 'This is a prop passed in \'startSingleScreenApp()\'!',
46
+           obj: {
47
+             str: 'This is a prop passed in an object!',
48
+             arr: [
49
+               {
50
+                 str: 'This is a prop in an object in an array in an object!'
51
+               }
52
+             ],
53
+             arr2: [
54
+               [
55
+                 'array of strings',
56
+                 'with two strings'
57
+               ],
58
+               [
59
+                 1, 2, 3
60
+               ]
61
+             ]
62
+           },
63
+           num: 1234,
64
+           fn: function() {
65
+             return 'Hello from a function!';
66
+           }
67
+         }
105 68
         });
69
+        // Navigation.startSingleScreenApp({
70
+        //   screen: {
71
+        //     screen: 'example.FirstTabScreen',
72
+        //     title: 'Login',
73
+        //     topTabs: [
74
+        //       {
75
+        //         screenId: 'example.FirstTabScreen',
76
+        //         title: 'Tab1',
77
+        //         passProps: {
78
+        //           str: 'This is a prop passed to Tab4',
79
+        //           fn: () => 'Hello from a function passed as passProps!'
80
+        //         }
81
+        //       },
82
+        //       {
83
+        //         screenId: 'example.PushedScreen',
84
+        //         title: 'Tab3',
85
+        //         passProps: {
86
+        //           str: 'This is a prop passed to Tab2'
87
+        //         }
88
+        //       },
89
+        //       {
90
+        //         screenId: 'example.ListScreen',
91
+        //         title: 'Tab2',
92
+        //         passProps: {
93
+        //           str: 'This is a prop passed to Tab1'
94
+        //         }
95
+        //       }
96
+        //     ],
97
+        //     navigatorStyle: {}
98
+        //   },
99
+        //   drawer: { // optional, add this if you want a side menu drawer in your app
100
+        //     left: { // optional, define if you want a drawer from the left
101
+        //       screen: 'example.SideMenu' // unique ID registered with Navigation.registerScreen
102
+        //     },
103
+        //     disableOpenGesture: false // optional, can the drawer be opened with a swipe instead of button
104
+        //   }
105
+        // });
106 106
         return;
107 107
       case 'after-login':
108 108
         Navigation.startTabBasedApp({

+ 0
- 1
example-redux/src/screens/BottomTabsSideMenu.js View File

@@ -69,7 +69,6 @@ class SideMenu extends Component {
69 69
   }
70 70
 
71 71
   onPushScreenToSecondTab() {
72
-    console.log('SideMenu', 'onPushScreenToSecondTab ' + 'tab2/pushScreen/example.PushedScreen');
73 72
     this.props.navigator.handleDeepLink({
74 73
       link: 'tab2/pushScreen/example.PushedScreen'
75 74
     });

+ 8
- 0
example-redux/src/screens/SecondTabScreen.js View File

@@ -41,6 +41,10 @@ class SecondTabScreen extends Component {
41 41
             <Text style={styles.button}>Increment Counter</Text>
42 42
           </TouchableOpacity>
43 43
 
44
+          <TouchableOpacity onPress={ this.onSelectFirstTabPress.bind(this) }>
45
+            <Text style={styles.button}>Select First Tab</Text>
46
+          </TouchableOpacity>
47
+
44 48
           <Text style={{fontWeight: '500'}}>String prop: {this.props.str}</Text>
45 49
           <Text style={{fontWeight: '500'}}>Number prop: {this.props.num}</Text>
46 50
           <Text style={{fontWeight: '500'}}>Object prop: {this.props.obj.str}</Text>
@@ -60,6 +64,10 @@ class SecondTabScreen extends Component {
60 64
     this.props.dispatch(counterActions.increment());
61 65
   }
62 66
 
67
+  onSelectFirstTabPress() {
68
+    this.props.navigator.switchToTab()
69
+  }
70
+
63 71
   onSetButton() {
64 72
     this.props.navigator.setButtons({
65 73
       rightButtons: [