浏览代码

[Android] Support custom icon for left nav button on TitleBar (#1013)



Support customize icon for left nav button in android
Jing Tai Piao 7 年前
父节点
当前提交
5d4757be00
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6
    1
      android/app/src/main/java/com/reactnativenavigation/views/TitleBar.java

+ 6
- 1
android/app/src/main/java/com/reactnativenavigation/views/TitleBar.java 查看文件

@@ -139,7 +139,12 @@ public class TitleBar extends Toolbar {
139 139
         leftButton = new LeftButton(getContext(), leftButtonParams, leftButtonOnClickListener, navigatorEventId,
140 140
                 overrideBackPressInJs);
141 141
         setNavigationOnClickListener(leftButton);
142
-        setNavigationIcon(leftButton);
142
+
143
+        if (leftButtonParams.icon != null) {
144
+            setNavigationIcon(leftButtonParams.icon);
145
+        } else {
146
+            setNavigationIcon(leftButton);
147
+        }
143 148
     }
144 149
 
145 150
     public void hide() {