Browse Source

Show Login screen first

Guy Carmeli 8 years ago
parent
commit
b47408b1ae
2 changed files with 17 additions and 2 deletions
  1. 1
    1
      example-redux/src/app.js
  2. 16
    1
      example-redux/src/screens/PushedScreen.js

+ 1
- 1
example-redux/src/app.js View File

@@ -37,7 +37,7 @@ export default class App {
37 37
       case 'login':
38 38
         Navigation.startSingleScreenApp({
39 39
           screen: {
40
-            screen: 'example.FirstTabScreen',
40
+            screen: 'example.LoginScreen',
41 41
             title: 'Login',
42 42
             navigatorStyle: {}
43 43
           },

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

@@ -5,7 +5,8 @@ import {
5 5
   ScrollView,
6 6
   TouchableOpacity,
7 7
   StyleSheet,
8
-  TextInput
8
+  TextInput,
9
+  Alert
9 10
 } from 'react-native';
10 11
 import {connect} from 'react-redux';
11 12
 import * as counterActions from '../reducers/counter/actions';
@@ -35,6 +36,7 @@ class PushedScreen extends Component {
35 36
     super(props);
36 37
     this.bgColor = this.getRandomColor();
37 38
     console.log(`constructor ${this.bgColor}`);
39
+    this.props.navigator.setOnNavigatorEvent(this.onNavigatorEvent.bind(this));
38 40
     this.currentBackButton = 0;
39 41
   }
40 42
 
@@ -51,6 +53,19 @@ class PushedScreen extends Component {
51 53
     return color;
52 54
   }
53 55
 
56
+  onNavigatorEvent(event) {
57
+    console.log('onNavigatorEvent ' + event.id);
58
+    switch (event.id) {
59
+      case 'cancel':
60
+        Alert.alert('NavBar', 'Cancel button pressed');
61
+        break;
62
+
63
+      case 'accept':
64
+        Alert.alert('NavBar', 'Accept button pressed');
65
+        break;
66
+    }
67
+  }
68
+
54 69
   render() {
55 70
     return (
56 71
       <View style={{flex: 1, padding: 20, backgroundColor: this.bgColor}}>