Browse Source

Merge branch 'master' of github.com:wix/react-native-navigation

Guy Carmeli 8 years ago
parent
commit
be56cd0c0e
4 changed files with 30 additions and 14 deletions
  1. 1
    0
      README.md
  2. 7
    12
      example/src/app.js
  3. 21
    1
      example/src/screens/FirstTabScreen.js
  4. 1
    1
      example/src/screens/PushedScreen.js

+ 1
- 0
README.md View File

@@ -42,6 +42,7 @@ If you're trying to deliver a user experience that's on par with the best native
42 42
 
43 43
 For example, this package replaces the native [NavigatorIOS](https://facebook.github.io/react-native/docs/navigatorios.html) that has been [abandoned](https://facebook.github.io/react-native/docs/navigator-comparison.html) in favor of JS-based solutions that are easier to maintain. For more details see in-depth discussion [here](https://github.com/wix/react-native-controllers#why-do-we-need-this-package).
44 44
 
45
+
45 46
 ## License
46 47
 
47 48
 The MIT License.

+ 7
- 12
example/src/app.js View File

@@ -12,17 +12,7 @@ Navigation.startTabBasedApp({
12 12
       screen: 'example.FirstTabScreen',
13 13
       icon: require('../img/one.png'),
14 14
       selectedIcon: require('../img/one_selected.png'),
15
-      title: 'Screen One',
16
-      navigatorStyle: {
17
-        navBarBackgroundColor: '#4dbce9',
18
-        navBarTextColor: '#ffff00',
19
-        navBarSubtitleTextColor: '#ff0000',
20
-        navBarButtonColor: '#ffffff',
21
-        statusBarTextColorScheme: 'light',
22
-        tabBarBackgroundColor: '#4dbce9',
23
-        tabBarButtonColor: '#ffffff',
24
-        tabBarSelectedButtonColor: '#ffff00'
25
-      }
15
+      title: 'Screen One'
26 16
     },
27 17
     {
28 18
       label: 'Two',
@@ -34,7 +24,12 @@ Navigation.startTabBasedApp({
34 24
         tabBarBackgroundColor: '#4dbce9',
35 25
       }
36 26
     }
37
-  ]
27
+  ],
28
+  drawer: {
29
+    left: {
30
+      screen: 'example.SideMenu'
31
+    }
32
+  }
38 33
 });
39 34
 // Navigation.startSingleScreenApp({
40 35
 //   screen: {

+ 21
- 1
example/src/screens/FirstTabScreen.js View File

@@ -7,6 +7,7 @@ import {
7 7
   Alert,
8 8
   Platform
9 9
 } from 'react-native';
10
+import {Navigation} from 'react-native-navigation';
10 11
 
11 12
 export default class FirstTabScreen extends Component {
12 13
   static navigatorButtons = {
@@ -26,7 +27,14 @@ export default class FirstTabScreen extends Component {
26 27
     ]
27 28
   };
28 29
   static navigatorStyle = {
29
-    drawUnderTabBar: true
30
+    navBarBackgroundColor: '#4dbce9',
31
+    navBarTextColor: '#ffff00',
32
+    navBarSubtitleTextColor: '#ff0000',
33
+    navBarButtonColor: '#ffffff',
34
+    statusBarTextColorScheme: 'light',
35
+    tabBarBackgroundColor: '#4dbce9',
36
+    tabBarButtonColor: '#ffffff',
37
+    tabBarSelectedButtonColor: '#ffff00'
30 38
   };
31 39
 
32 40
   constructor(props) {
@@ -78,6 +86,10 @@ export default class FirstTabScreen extends Component {
78 86
               <Text style={styles.button}>Show In-App Notification</Text>
79 87
             </TouchableOpacity> : false
80 88
         }
89
+
90
+        <TouchableOpacity onPress={ this.onStartSingleScreenApp.bind(this) }>
91
+          <Text style={styles.button}>Show Single Screen App</Text>
92
+        </TouchableOpacity>
81 93
       </View>
82 94
     );
83 95
   }
@@ -117,6 +129,14 @@ export default class FirstTabScreen extends Component {
117 129
       screen: "example.NotificationScreen"
118 130
     });
119 131
   }
132
+
133
+  onStartSingleScreenApp() {
134
+    Navigation.startSingleScreenApp({
135
+      screen: {
136
+        screen: 'example.FirstTabScreen'
137
+      }
138
+    });
139
+  }
120 140
 }
121 141
 
122 142
 const styles = StyleSheet.create({

+ 1
- 1
example/src/screens/PushedScreen.js View File

@@ -60,7 +60,7 @@ export default class PushedScreen extends Component {
60 60
   onResetToPress() {
61 61
     this.props.navigator.resetTo({
62 62
       title: "New Root",
63
-      screen: "example.PushedScreen"
63
+      screen: "example.ThirdTabScreen"
64 64
     });
65 65
   }
66 66
 }