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
+import {
2
+  Platform
3
+} from 'react-native';
1
 import {Navigation} from 'react-native-navigation';
4
 import {Navigation} from 'react-native-navigation';
2
 
5
 
3
 // screen related book keeping
6
 // screen related book keeping
4
 import {registerScreens} from './screens';
7
 import {registerScreens} from './screens';
5
 registerScreens();
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
       label: 'One',
13
       label: 'One',
18
       screen: 'example.FirstTabScreen',
14
       screen: 'example.FirstTabScreen',
30
         tabBarBackgroundColor: '#4dbce9',
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
   appStyle: {
43
   appStyle: {
35
     tabBarBackgroundColor: '#0f2362',
44
     tabBarBackgroundColor: '#0f2362',
36
     tabBarButtonColor: '#ffffff',
45
     tabBarButtonColor: '#ffffff',
37
     tabBarSelectedButtonColor: '#63d7cc'
46
     tabBarSelectedButtonColor: '#63d7cc'
38
-
47
+  },
48
+  drawer: {
49
+    left: {
50
+      screen: 'example.SideMenu'
51
+    }
39
   }
52
   }
40
 });
53
 });
41
 //Navigation.startSingleScreenApp({
54
 //Navigation.startSingleScreenApp({