瀏覽代碼

Fix BottomTabs style after pop

Guy Carmeli 8 年之前
父節點
當前提交
488a563c14
共有 1 個文件被更改,包括 7 次插入3 次删除
  1. 7
    3
      android/app/src/main/java/com/reactnativenavigation/layouts/BottomTabsLayout.java

+ 7
- 3
android/app/src/main/java/com/reactnativenavigation/layouts/BottomTabsLayout.java 查看文件

@@ -79,7 +79,7 @@ public class BottomTabsLayout extends RelativeLayout implements Layout, AHBottom
79 79
     public boolean onBackPressed() {
80 80
         if (getCurrentScreenStack().canPop()) {
81 81
             getCurrentScreenStack().pop();
82
-            bottomTabs.setStyleFromScreen(getCurrentScreenStack().getCurrentScreenStyleParams());
82
+            setBottomTabsStyleFromCurrentScreen();
83 83
             return true;
84 84
         } else {
85 85
             return false;
@@ -123,13 +123,13 @@ public class BottomTabsLayout extends RelativeLayout implements Layout, AHBottom
123 123
     @Override
124 124
     public void pop(ScreenParams screenParams) {
125 125
         getCurrentScreenStack().pop();
126
-        bottomTabs.setStyleFromScreen(screenParams.styleParams);
126
+        setBottomTabsStyleFromCurrentScreen();
127 127
     }
128 128
 
129 129
     @Override
130 130
     public void popToRoot(ScreenParams params) {
131 131
         getCurrentScreenStack().popToRoot();
132
-        bottomTabs.setStyleFromScreen(getCurrentScreenStack().getCurrentScreenStyleParams());
132
+        setBottomTabsStyleFromCurrentScreen();
133 133
     }
134 134
 
135 135
     @Override
@@ -176,4 +176,8 @@ public class BottomTabsLayout extends RelativeLayout implements Layout, AHBottom
176 176
     private ScreenStack getCurrentScreenStack() {
177 177
         return screenStacks[currentStackIndex];
178 178
     }
179
+
180
+    private void setBottomTabsStyleFromCurrentScreen() {
181
+        bottomTabs.setStyleFromScreen(getCurrentScreenStack().getCurrentScreenStyleParams());
182
+    }
179 183
 }