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
 
42
 
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).
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
 ## License
46
 ## License
46
 
47
 
47
 The MIT License.
48
 The MIT License.

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

12
       screen: 'example.FirstTabScreen',
12
       screen: 'example.FirstTabScreen',
13
       icon: require('../img/one.png'),
13
       icon: require('../img/one.png'),
14
       selectedIcon: require('../img/one_selected.png'),
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
       label: 'Two',
18
       label: 'Two',
34
         tabBarBackgroundColor: '#4dbce9',
24
         tabBarBackgroundColor: '#4dbce9',
35
       }
25
       }
36
     }
26
     }
37
-  ]
27
+  ],
28
+  drawer: {
29
+    left: {
30
+      screen: 'example.SideMenu'
31
+    }
32
+  }
38
 });
33
 });
39
 // Navigation.startSingleScreenApp({
34
 // Navigation.startSingleScreenApp({
40
 //   screen: {
35
 //   screen: {

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

7
   Alert,
7
   Alert,
8
   Platform
8
   Platform
9
 } from 'react-native';
9
 } from 'react-native';
10
+import {Navigation} from 'react-native-navigation';
10
 
11
 
11
 export default class FirstTabScreen extends Component {
12
 export default class FirstTabScreen extends Component {
12
   static navigatorButtons = {
13
   static navigatorButtons = {
26
     ]
27
     ]
27
   };
28
   };
28
   static navigatorStyle = {
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
   constructor(props) {
40
   constructor(props) {
78
               <Text style={styles.button}>Show In-App Notification</Text>
86
               <Text style={styles.button}>Show In-App Notification</Text>
79
             </TouchableOpacity> : false
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
       </View>
93
       </View>
82
     );
94
     );
83
   }
95
   }
117
       screen: "example.NotificationScreen"
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
 const styles = StyleSheet.create({
142
 const styles = StyleSheet.create({

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

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