ソースを参照

improved colorful nav bar example

talkol 8 年 前
コミット
c1777e8f8d
共有4 個のファイルを変更した59 個の追加12 個の削除を含む
  1. 6
    7
      example/ios/example/Info.plist
  2. 3
    2
      example/src/app.js
  3. 2
    1
      example/src/screens/StyledScreen.js
  4. 48
    2
      example/src/screens/ThirdTabScreen.js

+ 6
- 7
example/ios/example/Info.plist ファイルの表示

@@ -35,14 +35,13 @@
35 35
 		<string>UIInterfaceOrientationLandscapeRight</string>
36 36
 	</array>
37 37
 	<key>UIViewControllerBasedStatusBarAppearance</key>
38
-	<false/>
38
+	<true/>
39 39
 	<key>NSLocationWhenInUseUsageDescription</key>
40 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 46
 </dict>
48 47
 </plist>

+ 3
- 2
example/src/app.js ファイルの表示

@@ -28,8 +28,9 @@ Navigation.startTabBasedApp({
28 28
       title: 'Screen Three',
29 29
       navigatorStyle: {
30 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 ファイルの表示

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

+ 48
- 2
example/src/screens/ThirdTabScreen.js ファイルの表示

@@ -2,12 +2,18 @@ import React, {
2 2
   Text,
3 3
   View,
4 4
   ScrollView,
5
-  TouchableOpacity
5
+  TouchableOpacity,
6
+  StyleSheet
6 7
 } from 'react-native';
7 8
 
8 9
 // important imports, the magic is here
9 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 17
 // instead of React.Component, we extend Screen (imported above)
12 18
 class ThirdTabScreen extends Screen {
13 19
   constructor(props) {
@@ -16,11 +22,51 @@ class ThirdTabScreen extends Screen {
16 22
   render() {
17 23
     return (
18 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 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 71
 // every screen must be registered with a unique name
26 72
 Navigation.registerScreen('example.ThirdTabScreen', () => ThirdTabScreen);