Selaa lähdekoodia

Use margin instead of RelativeLayout rules to align component to BottomTabs

Rules caused excessive CPU usage due to RN issue with global layout listener
and keyboard visibility detection.
Guy Carmeli 6 vuotta sitten
vanhempi
commit
d12b501916

+ 1
- 2
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsController.java Näytä tiedosto

@@ -24,7 +24,6 @@ import java.util.List;
24 24
 
25 25
 import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
26 26
 import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
27
-import static android.widget.RelativeLayout.ABOVE;
28 27
 import static android.widget.RelativeLayout.ALIGN_PARENT_BOTTOM;
29 28
 
30 29
 public class BottomTabsController extends ParentController implements AHBottomNavigation.OnTabSelectedListener, NavigationOptionsListener {
@@ -150,7 +149,7 @@ public class BottomTabsController extends ParentController implements AHBottomNa
150 149
         getView().removeView(getCurrentView());
151 150
         bottomTabs.setCurrentItem(newIndex, false);
152 151
         RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT);
153
-        params.addRule(ABOVE, bottomTabs.getId());
152
+        params.bottomMargin = bottomTabs.getHeight();
154 153
         getView().addView(getCurrentView(), params);
155 154
     }
156 155