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
       case 'login':
37
       case 'login':
38
         Navigation.startSingleScreenApp({
38
         Navigation.startSingleScreenApp({
39
           screen: {
39
           screen: {
40
-            screen: 'example.FirstTabScreen',
40
+            screen: 'example.LoginScreen',
41
             title: 'Login',
41
             title: 'Login',
42
             navigatorStyle: {}
42
             navigatorStyle: {}
43
           },
43
           },

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

5
   ScrollView,
5
   ScrollView,
6
   TouchableOpacity,
6
   TouchableOpacity,
7
   StyleSheet,
7
   StyleSheet,
8
-  TextInput
8
+  TextInput,
9
+  Alert
9
 } from 'react-native';
10
 } from 'react-native';
10
 import {connect} from 'react-redux';
11
 import {connect} from 'react-redux';
11
 import * as counterActions from '../reducers/counter/actions';
12
 import * as counterActions from '../reducers/counter/actions';
35
     super(props);
36
     super(props);
36
     this.bgColor = this.getRandomColor();
37
     this.bgColor = this.getRandomColor();
37
     console.log(`constructor ${this.bgColor}`);
38
     console.log(`constructor ${this.bgColor}`);
39
+    this.props.navigator.setOnNavigatorEvent(this.onNavigatorEvent.bind(this));
38
     this.currentBackButton = 0;
40
     this.currentBackButton = 0;
39
   }
41
   }
40
 
42
 
51
     return color;
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
   render() {
69
   render() {
55
     return (
70
     return (
56
       <View style={{flex: 1, padding: 20, backgroundColor: this.bgColor}}>
71
       <View style={{flex: 1, padding: 20, backgroundColor: this.bgColor}}>