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
 package com.reactnativenavigation.views.collapsingToolbar;
1
 package com.reactnativenavigation.views.collapsingToolbar;
2
 
2
 
3
+import com.reactnativenavigation.layouts.BottomTabsLayout;
3
 import com.reactnativenavigation.params.StyleParams;
4
 import com.reactnativenavigation.params.StyleParams;
4
 import com.reactnativenavigation.screens.Screen;
5
 import com.reactnativenavigation.screens.Screen;
5
 import com.reactnativenavigation.utils.ViewUtils;
6
 import com.reactnativenavigation.utils.ViewUtils;
6
 
7
 
7
 public class CollapsingViewPagerContentViewMeasurer extends CollapsingViewMeasurer {
8
 public class CollapsingViewPagerContentViewMeasurer extends CollapsingViewMeasurer {
8
     private int titleBarHeight;
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
         super(topBar, screen, styleParams);
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
         ViewUtils.runOnPreDraw(topBar, new Runnable() {
20
         ViewUtils.runOnPreDraw(topBar, new Runnable() {
13
             @Override
21
             @Override
14
             public void run() {
22
             public void run() {
34
     }
42
     }
35
 
43
 
36
     private boolean hasBottomTabs() {
44
     private boolean hasBottomTabs() {
37
-        return !styleParams.bottomTabsHidden;
45
+        return layoutHasBottomTabs && !styleParams.bottomTabsHidden;
38
     }
46
     }
39
 }
47
 }