Bladeren bron

fixed example on android - runs but not 100%

Daniel Zlotin 8 jaren geleden
bovenliggende
commit
33e5ad11eb

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

@@ -22,9 +22,8 @@ public class TitleBarLeftButtonParamsParser extends TitleBarButtonParamsParser {
22 22
             case "accept":
23 23
                 return MaterialMenuDrawable.IconState.CHECK;
24 24
             case "sideMenu":
25
-                return MaterialMenuDrawable.IconState.BURGER;
26 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 Bestand weergeven

@@ -3,8 +3,9 @@
3 3
   "version": "0.0.1",
4 4
   "private": true,
5 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 10
   "dependencies": {
10 11
     "react-native": "0.31.0",

+ 3
- 4
example/src/screens/FirstTabScreen.js Bestand weergeven

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