Browse Source

fixed example on android - runs but not 100%

Daniel Zlotin 8 years ago
parent
commit
33e5ad11eb

+ 1
- 2
android/app/src/main/java/com/reactnativenavigation/params/parsers/TitleBarLeftButtonParamsParser.java View File

22
             case "accept":
22
             case "accept":
23
                 return MaterialMenuDrawable.IconState.CHECK;
23
                 return MaterialMenuDrawable.IconState.CHECK;
24
             case "sideMenu":
24
             case "sideMenu":
25
-                return MaterialMenuDrawable.IconState.BURGER;
26
             default:
25
             default:
27
-                throw new RuntimeException("Unsupported button id: " + id + ". Supported ids are: back, cancel, accept and sideMenu");
26
+                return MaterialMenuDrawable.IconState.BURGER;
28
         }
27
         }
29
     }
28
     }
30
 }
29
 }

+ 3
- 2
example/package.json View File

3
   "version": "0.0.1",
3
   "version": "0.0.1",
4
   "private": true,
4
   "private": true,
5
   "scripts": {
5
   "scripts": {
6
-    "start": "watchman watch-del-all && (adb reverse tcp:8081 tcp: 8081 || true) && node node_modules/react-native/local-cli/cli.js start",
7
-    "xcode": "open ios/example.xcodeproj"
6
+    "start": "watchman watch-del-all && (adb reverse tcp:8081 tcp:8081 || true) && node node_modules/react-native/local-cli/cli.js start",
7
+    "xcode": "open ios/example.xcodeproj",
8
+    "android": "cd android && ./gradlew installDebug"
8
   },
9
   },
9
   "dependencies": {
10
   "dependencies": {
10
     "react-native": "0.31.0",
11
     "react-native": "0.31.0",

+ 3
- 4
example/src/screens/FirstTabScreen.js View File

2
 import {
2
 import {
3
   Text,
3
   Text,
4
   View,
4
   View,
5
-  ScrollView,
6
   TouchableOpacity,
5
   TouchableOpacity,
7
   StyleSheet,
6
   StyleSheet,
8
   AlertIOS
7
   AlertIOS
36
   }
35
   }
37
 
36
 
38
   onNavigatorEvent(event) {
37
   onNavigatorEvent(event) {
39
-    if (event.id == 'menu') {
38
+    if (event.id === 'menu') {
40
       this.props.navigator.toggleDrawer({
39
       this.props.navigator.toggleDrawer({
41
         side: 'left',
40
         side: 'left',
42
         animated: true
41
         animated: true
43
       });
42
       });
44
     }
43
     }
45
-    if (event.id == 'edit') {
44
+    if (event.id === 'edit') {
46
       AlertIOS.alert('NavBar', 'Edit button pressed');
45
       AlertIOS.alert('NavBar', 'Edit button pressed');
47
     }
46
     }
48
-    if (event.id == 'add') {
47
+    if (event.id === 'add') {
49
       AlertIOS.alert('NavBar', 'Add button pressed');
48
       AlertIOS.alert('NavBar', 'Add button pressed');
50
     }
49
     }
51
   }
50
   }