Browse Source

Add CollapsingTopBar screen to Android example

Guy Carmeli 7 years ago
parent
commit
2209566a90
1 changed files with 24 additions and 11 deletions
  1. 24
    11
      example/src/app.js

+ 24
- 11
example/src/app.js View File

@@ -1,18 +1,14 @@
1
+import {
2
+  Platform
3
+} from 'react-native';
1 4
 import {Navigation} from 'react-native-navigation';
2 5
 
3 6
 // screen related book keeping
4 7
 import {registerScreens} from './screens';
5 8
 registerScreens();
6 9
 
7
-// this will start our app
8
-Navigation.startTabBasedApp({
9
-  tabs: [
10
-    {
11
-      label: 'Collapsing',
12
-      screen: 'example.CollapsingTopBarScreen',
13
-      icon: require('../img/one.png'),
14
-      title: 'Collapsing',
15
-    },
10
+const createTabs = () => {
11
+  let tabs = [
16 12
     {
17 13
       label: 'One',
18 14
       screen: 'example.FirstTabScreen',
@@ -30,12 +26,29 @@ Navigation.startTabBasedApp({
30 26
         tabBarBackgroundColor: '#4dbce9',
31 27
       }
32 28
     }
33
-  ],
29
+  ];
30
+  if (Platform.OS === 'android') {
31
+    tabs.push({
32
+      label: 'Collapsing',
33
+      screen: 'example.CollapsingTopBarScreen',
34
+      icon: require('../img/one.png'),
35
+      title: 'Collapsing',
36
+    });
37
+  }
38
+  return tabs;
39
+};
40
+// this will start our app
41
+Navigation.startTabBasedApp({
42
+  tabs: createTabs(),
34 43
   appStyle: {
35 44
     tabBarBackgroundColor: '#0f2362',
36 45
     tabBarButtonColor: '#ffffff',
37 46
     tabBarSelectedButtonColor: '#63d7cc'
38
-
47
+  },
48
+  drawer: {
49
+    left: {
50
+      screen: 'example.SideMenu'
51
+    }
39 52
   }
40 53
 });
41 54
 //Navigation.startSingleScreenApp({