瀏覽代碼

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 年之前
父節點
當前提交
110fb0773f
共有 1 個檔案被更改,包括 1 行新增1 行删除
  1. 1
    1
      lib/android/app/src/main/java/com/reactnativenavigation/views/ComponentLayout.java

+ 1
- 1
lib/android/app/src/main/java/com/reactnativenavigation/views/ComponentLayout.java 查看文件

@@ -94,7 +94,7 @@ public class ComponentLayout extends FrameLayout implements ReactComponent, Titl
94 94
             RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) getLayoutParams();
95 95
             int topBarHeight = ViewUtils.getPreferredHeight(topBar);
96 96
             if (topBarHeight == 0) {
97
-                UiUtils.runOnPreDrawOnce(topBar, () -> layoutParams.topMargin = topBar.getHeight());
97
+                UiUtils.runOnMeasured(topBar, () -> layoutParams.topMargin = topBar.getHeight());
98 98
             } else {
99 99
                 layoutParams.topMargin = topBarHeight;
100 100
             }