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
                 error.printStackTrace();
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
     public int getSelectedIndex() {
133
     public int getSelectedIndex() {
152
     public void selectTabAtIndex(final int newIndex) {
149
     public void selectTabAtIndex(final int newIndex) {
153
         getView().removeView(getCurrentView());
150
         getView().removeView(getCurrentView());
154
         bottomTabs.setCurrentItem(newIndex, false);
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
     @NonNull
157
     @NonNull