Browse Source

Fix BottomTabs check in CollapsingViewPagerContentViewMeasurer (#1094)

fixes #942
Guy Carmeli 7 years ago
parent
commit
6138a79a8c

+ 10
- 2
android/app/src/main/java/com/reactnativenavigation/views/collapsingToolbar/CollapsingViewPagerContentViewMeasurer.java View File

@@ -1,14 +1,22 @@
1 1
 package com.reactnativenavigation.views.collapsingToolbar;
2 2
 
3
+import com.reactnativenavigation.layouts.BottomTabsLayout;
3 4
 import com.reactnativenavigation.params.StyleParams;
4 5
 import com.reactnativenavigation.screens.Screen;
5 6
 import com.reactnativenavigation.utils.ViewUtils;
6 7
 
7 8
 public class CollapsingViewPagerContentViewMeasurer extends CollapsingViewMeasurer {
8 9
     private int titleBarHeight;
10
+    private boolean layoutHasBottomTabs;
9 11
 
10
-    public CollapsingViewPagerContentViewMeasurer(final CollapsingTopBar topBar, Screen screen, StyleParams styleParams) {
12
+    public CollapsingViewPagerContentViewMeasurer(final CollapsingTopBar topBar, final Screen screen, StyleParams styleParams) {
11 13
         super(topBar, screen, styleParams);
14
+        ViewUtils.runOnPreDraw(screen, new Runnable() {
15
+            @Override
16
+            public void run() {
17
+                layoutHasBottomTabs = screen.getParent() instanceof BottomTabsLayout;
18
+            }
19
+        });
12 20
         ViewUtils.runOnPreDraw(topBar, new Runnable() {
13 21
             @Override
14 22
             public void run() {
@@ -34,6 +42,6 @@ public class CollapsingViewPagerContentViewMeasurer extends CollapsingViewMeasur
34 42
     }
35 43
 
36 44
     private boolean hasBottomTabs() {
37
-        return !styleParams.bottomTabsHidden;
45
+        return layoutHasBottomTabs && !styleParams.bottomTabsHidden;
38 46
     }
39 47
 }