Browse Source

Restore layout params for bottom tabs children (#2974)

PR #2658 removed layout params from the child views, which causes
component children to receive zero width. Stack children work since
they don’t need the layout params.
Leo Nikkilä 6 years ago
parent
commit
5575d70874

+ 3
- 4
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsController.java View File

@@ -128,9 +128,6 @@ public class BottomTabsController extends ParentController implements AHBottomNa
128 128
                 error.printStackTrace();
129 129
             }
130 130
         });
131
-
132
-        RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT);
133
-        params.addRule(ABOVE, bottomTabs.getId());
134 131
 	}
135 132
 
136 133
     public int getSelectedIndex() {
@@ -152,7 +149,9 @@ public class BottomTabsController extends ParentController implements AHBottomNa
152 149
     public void selectTabAtIndex(final int newIndex) {
153 150
         getView().removeView(getCurrentView());
154 151
         bottomTabs.setCurrentItem(newIndex, false);
155
-        getView().addView(getCurrentView());
152
+        RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT);
153
+        params.addRule(ABOVE, bottomTabs.getId());
154
+        getView().addView(getCurrentView(), params);
156 155
     }
157 156
 
158 157
     @NonNull