Bladeren bron

Minor change to example project

Added startSingleScreenApp button
Guy Carmeli 8 jaren geleden
bovenliggende
commit
9df47ac60c
2 gewijzigde bestanden met toevoegingen van 22 en 9 verwijderingen
  1. 21
    8
      example/src/screens/FirstTabScreen.js
  2. 1
    1
      example/src/screens/PushedScreen.js

+ 21
- 8
example/src/screens/FirstTabScreen.js Bestand weergeven

@@ -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,14 +27,14 @@ export default class FirstTabScreen extends Component {
26 27
     ]
27 28
   };
28 29
   static navigatorStyle = {
29
-      navBarBackgroundColor: '#4dbce9',
30
-      navBarTextColor: '#ffff00',
31
-      navBarSubtitleTextColor: '#ff0000',
32
-      navBarButtonColor: '#ffffff',
33
-      statusBarTextColorScheme: 'light',
34
-      tabBarBackgroundColor: '#4dbce9',
35
-      tabBarButtonColor: '#ffffff',
36
-      tabBarSelectedButtonColor: '#ffff00'
30
+    navBarBackgroundColor: '#4dbce9',
31
+    navBarTextColor: '#ffff00',
32
+    navBarSubtitleTextColor: '#ff0000',
33
+    navBarButtonColor: '#ffffff',
34
+    statusBarTextColorScheme: 'light',
35
+    tabBarBackgroundColor: '#4dbce9',
36
+    tabBarButtonColor: '#ffffff',
37
+    tabBarSelectedButtonColor: '#ffff00'
37 38
   };
38 39
 
39 40
   constructor(props) {
@@ -85,6 +86,10 @@ export default class FirstTabScreen extends Component {
85 86
               <Text style={styles.button}>Show In-App Notification</Text>
86 87
             </TouchableOpacity> : false
87 88
         }
89
+
90
+        <TouchableOpacity onPress={ this.onStartSingleScreenApp.bind(this) }>
91
+          <Text style={styles.button}>Show Single Screen App</Text>
92
+        </TouchableOpacity>
88 93
       </View>
89 94
     );
90 95
   }
@@ -124,6 +129,14 @@ export default class FirstTabScreen extends Component {
124 129
       screen: "example.NotificationScreen"
125 130
     });
126 131
   }
132
+
133
+  onStartSingleScreenApp() {
134
+    Navigation.startSingleScreenApp({
135
+      screen: {
136
+        screen: 'example.FirstTabScreen'
137
+      }
138
+    });
139
+  }
127 140
 }
128 141
 
129 142
 const styles = StyleSheet.create({

+ 1
- 1
example/src/screens/PushedScreen.js Bestand weergeven

@@ -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.FirstTabScreen"
63
+      screen: "example.ThirdTabScreen"
64 64
     });
65 65
   }
66 66
 }