ソースを参照

Support drawScreenAboveBottomTabs

Guy Carmeli 8 年 前
コミット
a9e4e2c4bb

+ 11
- 1
android/app/src/main/java/com/reactnativenavigation/layouts/BottomTabsLayout.java ファイルの表示

@@ -50,11 +50,21 @@ public class BottomTabsLayout extends RelativeLayout implements Layout, AHBottom
50 50
         ScreenStack newStack = new ScreenStack(activity, params.tabParams.get(position), this);
51 51
         screenStacks[position] = newStack;
52 52
         newStack.setVisibility(INVISIBLE);
53
+        addScreenStack(newStack);
54
+    }
55
+
56
+    private void addScreenStack(ScreenStack newStack) {
53 57
         LayoutParams lp = new LayoutParams(MATCH_PARENT, MATCH_PARENT);
54
-        lp.addRule(ABOVE, bottomTabs.getId());
58
+        if (shouldDrawScreenStackAboveBottomTabs(newStack)) {
59
+            lp.addRule(ABOVE, bottomTabs.getId());
60
+        }
55 61
         addView(newStack, 0, lp);
56 62
     }
57 63
 
64
+    private boolean shouldDrawScreenStackAboveBottomTabs(ScreenStack newStack) {
65
+        return newStack.getCurrentScreenStyleParams().drawScreenAboveBottomTabs;
66
+    }
67
+
58 68
     private void createBottomTabs() {
59 69
         bottomTabs = new BottomTabs(getContext());
60 70
         bottomTabs.addTabs(params.tabParams, this);

+ 3
- 2
android/app/src/main/java/com/reactnativenavigation/params/StyleParams.java ファイルの表示

@@ -39,6 +39,7 @@ public class StyleParams {
39 39
     public Color topBarColor;
40 40
     public boolean topBarHidden;
41 41
     public boolean topTabsHidden;
42
+    public boolean drawScreenBelowTopBar;
42 43
 
43 44
     public boolean titleBarHidden;
44 45
     public Color titleBarTitleColor;
@@ -50,6 +51,8 @@ public class StyleParams {
50 51
     public int selectedTopTabIndicatorHeight;
51 52
     public Color selectedTopTabIndicatorColor;
52 53
 
54
+    public boolean drawScreenAboveBottomTabs;
55
+
53 56
     public boolean bottomTabsHidden;
54 57
     public boolean bottomTabsHiddenOnScroll;
55 58
     public Color bottomTabsColor;
@@ -57,6 +60,4 @@ public class StyleParams {
57 60
     public Color bottomTabsButtonColor;
58 61
 
59 62
     public Color navigationBarColor;
60
-
61
-    public boolean drawScreenBelowTopBar;
62 63
 }

+ 7
- 0
android/app/src/main/java/com/reactnativenavigation/params/parsers/StyleParamsParser.java ファイルの表示

@@ -38,6 +38,9 @@ public class StyleParamsParser {
38 38
         //result.drawScreenBelowTopBar = params.getBoolean("drawBelowTopBar", isDefaultScreenBelowTopBar());
39 39
         result.drawScreenBelowTopBar = true;
40 40
 
41
+        result.drawScreenAboveBottomTabs =
42
+                params.getBoolean("drawScreenAboveBottomTabs", getDefaultDrawScreenAboveBottomTabs());
43
+
41 44
         result.bottomTabsHidden = getBoolean("bottomTabsHidden", getDefaultBottomTabsHidden());
42 45
         result.bottomTabsHiddenOnScroll =
43 46
                 getBoolean("bottomTabsHiddenOnScroll", getDefaultBottomTabsHiddenOnScroll());
@@ -51,6 +54,10 @@ public class StyleParamsParser {
51 54
         return result;
52 55
     }
53 56
 
57
+    private boolean getDefaultDrawScreenAboveBottomTabs() {
58
+        return AppStyle.appStyle == null || AppStyle.appStyle.drawScreenAboveBottomTabs;
59
+    }
60
+
54 61
     private StyleParams.Color getDefaultSelectedTopTabIndicatorColor() {
55 62
         return AppStyle.appStyle == null ? new StyleParams.Color() : AppStyle.appStyle.selectedTopTabIndicatorColor;
56 63
     }

+ 2
- 0
src/deprecated/platformSpecificDeprecated.android.js ファイルの表示

@@ -109,6 +109,8 @@ function convertStyleParams(originalStyleObject) {
109 109
     selectedTopTabIndicatorHeight: originalStyleObject.selectedTopTabIndicatorHeight,
110 110
     selectedTopTabIndicatorColor: originalStyleObject.selectedTopTabIndicatorColor,
111 111
 
112
+    drawScreenAboveBottomTabs: !originalStyleObject.drawUnderTabBar,
113
+
112 114
     bottomTabsColor: originalStyleObject.tabBarBackgroundColor,
113 115
     bottomTabsButtonColor: originalStyleObject.tabBarButtonColor,
114 116
     bottomTabsSelectedButtonColor: originalStyleObject.tabBarSelectedButtonColor,