Browse Source

topBar visible applies on entire ComponentLayout

Guy Carmeli 6 years ago
parent
commit
d3ddd12f43

+ 2
- 2
lib/android/app/src/main/java/com/reactnativenavigation/views/ComponentLayout.java View File

@@ -77,14 +77,14 @@ public class ComponentLayout extends FrameLayout implements ReactComponent, Titl
77 77
     public void drawBehindTopBar() {
78 78
         RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) getLayoutParams();
79 79
         layoutParams.removeRule(BELOW);
80
-        reactView.asView().setLayoutParams(layoutParams);
80
+        setLayoutParams(layoutParams);
81 81
     }
82 82
 
83 83
     @Override
84 84
     public void drawBelowTopBar(TopBar topBar) {
85 85
         RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) getLayoutParams();
86 86
         layoutParams.addRule(BELOW, topBar.getId());
87
-        reactView.asView().setLayoutParams(layoutParams);
87
+        setLayoutParams(layoutParams);
88 88
     }
89 89
 
90 90
     @Override

+ 0
- 71
lib/android/app/src/test/java/com/reactnativenavigation/mocks/TopTabLayoutMock.java View File

@@ -1,71 +0,0 @@
1
-package com.reactnativenavigation.mocks;
2
-
3
-import android.content.*;
4
-import android.view.*;
5
-
6
-import com.reactnativenavigation.interfaces.ScrollEventListener;
7
-import com.reactnativenavigation.parse.Options;
8
-import com.reactnativenavigation.views.ReactComponent;
9
-import com.reactnativenavigation.views.TopBar;
10
-
11
-public class TopTabLayoutMock extends View implements ReactComponent {
12
-
13
-    public TopTabLayoutMock(Context context) {
14
-        super(context);
15
-    }
16
-
17
-    @Override
18
-    public boolean isReady() {
19
-        return false;
20
-    }
21
-
22
-    @Override
23
-    public View asView() {
24
-        return this;
25
-    }
26
-
27
-    @Override
28
-    public void destroy() {
29
-
30
-    }
31
-
32
-    @Override
33
-    public void sendComponentStart() {
34
-
35
-    }
36
-
37
-    @Override
38
-    public void sendComponentStop() {
39
-
40
-    }
41
-
42
-    @Override
43
-    public void sendOnNavigationButtonPressed(String buttonId) {
44
-
45
-    }
46
-
47
-    @Override
48
-    public ScrollEventListener getScrollEventListener() {
49
-        return null;
50
-    }
51
-
52
-    @Override
53
-    public void dispatchTouchEventToJs(MotionEvent event) {
54
-
55
-    }
56
-
57
-    @Override
58
-    public void applyOptions(Options options) {
59
-
60
-    }
61
-
62
-    @Override
63
-    public void drawBehindTopBar() {
64
-
65
-    }
66
-
67
-    @Override
68
-    public void drawBelowTopBar(TopBar topBar) {
69
-
70
-    }
71
-}

+ 1
- 2
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/OptionsApplyingTest.java View File

@@ -4,7 +4,6 @@ import android.app.Activity;
4 4
 import android.graphics.Color;
5 5
 import android.graphics.drawable.ColorDrawable;
6 6
 import android.view.View;
7
-import android.view.ViewGroup;
8 7
 import android.widget.RelativeLayout;
9 8
 
10 9
 import com.reactnativenavigation.BaseTest;
@@ -165,7 +164,7 @@ public class OptionsApplyingTest extends BaseTest {
165 164
         stackController.animatePush(uut, new MockPromise() {
166 165
             @Override
167 166
             public void resolve(@Nullable Object value) {
168
-                RelativeLayout.LayoutParams uutLayoutParams = (RelativeLayout.LayoutParams) ((ViewGroup) uut.getComponent().asView()).getChildAt(0).getLayoutParams();
167
+                RelativeLayout.LayoutParams uutLayoutParams = (RelativeLayout.LayoutParams) uut.getComponent().asView().getLayoutParams();
169 168
                 assertThat(uutLayoutParams.getRule(BELOW)).isNotEqualTo(0);
170 169
 
171 170
                 Options opts = new Options();