Browse Source

improved colorful nav bar example

talkol 8 years ago
parent
commit
c1777e8f8d

+ 6
- 7
example/ios/example/Info.plist View File

35
 		<string>UIInterfaceOrientationLandscapeRight</string>
35
 		<string>UIInterfaceOrientationLandscapeRight</string>
36
 	</array>
36
 	</array>
37
 	<key>UIViewControllerBasedStatusBarAppearance</key>
37
 	<key>UIViewControllerBasedStatusBarAppearance</key>
38
-	<false/>
38
+	<true/>
39
 	<key>NSLocationWhenInUseUsageDescription</key>
39
 	<key>NSLocationWhenInUseUsageDescription</key>
40
 	<string></string>
40
 	<string></string>
41
-  <key>NSAppTransportSecurity</key>
42
-  <dict>
43
-    <!--See http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/ -->
44
-    <key>NSAllowsArbitraryLoads</key>
45
-    <true/>
46
-  </dict>
41
+	<key>NSAppTransportSecurity</key>
42
+	<dict>
43
+		<key>NSAllowsArbitraryLoads</key>
44
+		<true/>
45
+	</dict>
47
 </dict>
46
 </dict>
48
 </plist>
47
 </plist>

+ 3
- 2
example/src/app.js View File

28
       title: 'Screen Three',
28
       title: 'Screen Three',
29
       navigatorStyle: {
29
       navigatorStyle: {
30
         navBarBackgroundColor: '#4dbce9',
30
         navBarBackgroundColor: '#4dbce9',
31
-        navBarTextColor: '#f7f7f7',
32
-        navBarButtonColor: '#ffffff'
31
+        navBarTextColor: '#ffff00',
32
+        navBarButtonColor: '#ffffff',
33
+        statusBarTextColorScheme: 'light'
33
       }
34
       }
34
     }
35
     }
35
   ]
36
   ]

+ 2
- 1
example/src/screens/StyledScreen.js View File

18
 class StyledScreen extends Screen {
18
 class StyledScreen extends Screen {
19
   static navigatorStyle = {
19
   static navigatorStyle = {
20
     drawUnderNavBar: true,
20
     drawUnderNavBar: true,
21
-    drawUnderTabBar: true
21
+    drawUnderTabBar: true,
22
+    navBarTranslucent: true
22
   };
23
   };
23
   constructor(props) {
24
   constructor(props) {
24
     super(props);
25
     super(props);

+ 48
- 2
example/src/screens/ThirdTabScreen.js View File

2
   Text,
2
   Text,
3
   View,
3
   View,
4
   ScrollView,
4
   ScrollView,
5
-  TouchableOpacity
5
+  TouchableOpacity,
6
+  StyleSheet
6
 } from 'react-native';
7
 } from 'react-native';
7
 
8
 
8
 // important imports, the magic is here
9
 // important imports, the magic is here
9
 import { Navigation, Screen } from 'react-native-navigation';
10
 import { Navigation, Screen } from 'react-native-navigation';
10
 
11
 
12
+// need to import every screen we push
13
+import './PushedScreen';
14
+import './StyledScreen';
15
+import './ModalScreen';
16
+
11
 // instead of React.Component, we extend Screen (imported above)
17
 // instead of React.Component, we extend Screen (imported above)
12
 class ThirdTabScreen extends Screen {
18
 class ThirdTabScreen extends Screen {
13
   constructor(props) {
19
   constructor(props) {
16
   render() {
22
   render() {
17
     return (
23
     return (
18
       <View style={{flex: 1, padding: 20}}>
24
       <View style={{flex: 1, padding: 20}}>
19
-        <Text>Third Tab Screen</Text>
25
+
26
+        <TouchableOpacity onPress={ this.onPushPress.bind(this) }>
27
+          <Text style={styles.button}>Push Plain Screen</Text>
28
+        </TouchableOpacity>
29
+
30
+        <TouchableOpacity onPress={ this.onPushStyledPress.bind(this) }>
31
+          <Text style={styles.button}>Push Styled Screen</Text>
32
+        </TouchableOpacity>
33
+
34
+        <TouchableOpacity onPress={ this.onModalPress.bind(this) }>
35
+          <Text style={styles.button}>Show Modal Screen</Text>
36
+        </TouchableOpacity>
37
+
20
       </View>
38
       </View>
21
     );
39
     );
22
   }
40
   }
41
+  onPushPress() {
42
+    this.navigator.push({
43
+      title: "More",
44
+      screen: "example.PushedScreen"
45
+    });
46
+  }
47
+  onPushStyledPress() {
48
+    this.navigator.push({
49
+      title: "Styled",
50
+      screen: "example.StyledScreen"
51
+    });
52
+  }
53
+  onModalPress() {
54
+    this.navigator.showModal({
55
+      title: "Modal",
56
+      screen: "example.ModalScreen"
57
+    });
58
+  }
23
 }
59
 }
24
 
60
 
61
+const styles = StyleSheet.create({
62
+  button: {
63
+    textAlign: 'center',
64
+    fontSize: 18,
65
+    marginBottom: 10,
66
+    marginTop:10,
67
+    color: 'blue'
68
+  }
69
+});
70
+
25
 // every screen must be registered with a unique name
71
 // every screen must be registered with a unique name
26
 Navigation.registerScreen('example.ThirdTabScreen', () => ThirdTabScreen);
72
 Navigation.registerScreen('example.ThirdTabScreen', () => ThirdTabScreen);