Browse Source

Minor contextualMenu fixes (#601)

* Pass showAsAction property to native. It was left out by mistake
* Support textual icons in contextual menu
Guy Carmeli 7 years ago
parent
commit
bd94837a62

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

@@ -20,7 +20,9 @@ public class ContextualMenuButtonParamsParser extends TitleBarButtonParamsParser
20 20
 
21 21
     private ContextualMenuButtonParams parseSingleContextualMenuButton(Bundle button) {
22 22
         ContextualMenuButtonParams result = new ContextualMenuButtonParams();
23
-        result.icon = ImageLoader.loadImage(button.getString("icon"));
23
+        if (button.get("icon") != null) {
24
+            result.icon = ImageLoader.loadImage(button.getString("icon"));
25
+        }
24 26
         result.showAsAction = parseShowAsAction(button.getString("showAsAction"));
25 27
         result.color = StyleParams.Color.parse(button, "color");
26 28
         result.label = button.getString("label");

+ 5
- 1
src/deprecated/platformSpecificDeprecated.android.js View File

@@ -520,11 +520,15 @@ function showContextualMenu(navigator, params) {
520 520
 
521 521
   params.rightButtons.forEach((button, index) => {
522 522
     const btn = {
523
-      icon: resolveAssetSource(button.icon).uri,
523
+      icon: resolveAssetSource(button.icon),
524
+      showAsAction: button.showAsAction,
524 525
       color: processColor(button.color),
525 526
       label: button.title,
526 527
       index
527 528
     };
529
+    if (btn.icon) {
530
+      btn.icon = btn.icon.uri;
531
+    }
528 532
     contextualMenu.buttons.push(btn);
529 533
   });
530 534