Browse Source

Draw view below TopBar after TopBar is measured

When TopBar is initially hidden it’s never measured, therefor when pushing a screen we need to wait for it to be measured before taking its height into account
when handling drawBehind properties and the like.
Guy Carmeli 6 years ago
parent
commit
110fb0773f

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

94
             RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) getLayoutParams();
94
             RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) getLayoutParams();
95
             int topBarHeight = ViewUtils.getPreferredHeight(topBar);
95
             int topBarHeight = ViewUtils.getPreferredHeight(topBar);
96
             if (topBarHeight == 0) {
96
             if (topBarHeight == 0) {
97
-                UiUtils.runOnPreDrawOnce(topBar, () -> layoutParams.topMargin = topBar.getHeight());
97
+                UiUtils.runOnMeasured(topBar, () -> layoutParams.topMargin = topBar.getHeight());
98
             } else {
98
             } else {
99
                 layoutParams.topMargin = topBarHeight;
99
                 layoutParams.topMargin = topBarHeight;
100
             }
100
             }