ソースを参照

Delay onDisplay until react finishes layout cycle

Apparently runOnPreDraw is not enough anymore, possibly broke in RN 0.51
Guy Carmeli 6 年 前
コミット
90b47f7910
共有1 個のファイルを変更した12 個の追加7 個の削除を含む
  1. 12
    7
      android/app/src/main/java/com/reactnativenavigation/views/ContentView.java

+ 12
- 7
android/app/src/main/java/com/reactnativenavigation/views/ContentView.java ファイルの表示

@@ -81,16 +81,21 @@ public class ContentView extends ReactRootView {
81 81
         detectContentViewVisible(child);
82 82
     }
83 83
 
84
-    private void detectContentViewVisible(View child) {
84
+    private void detectContentViewVisible(final View child) {
85 85
         if (onDisplayListener != null) {
86
-            ViewUtils.runOnPreDraw(child, new Runnable() {
86
+            post(new Runnable() {
87 87
                 @Override
88 88
                 public void run() {
89
-                    if (!isContentVisible) {
90
-                        isContentVisible = true;
91
-                        onDisplayListener.onDisplay();
92
-                        onDisplayListener = null;
93
-                    }
89
+                    ViewUtils.runOnPreDraw(child, new Runnable() {
90
+                        @Override
91
+                        public void run() {
92
+                            if (!isContentVisible) {
93
+                                isContentVisible = true;
94
+                                onDisplayListener.onDisplay();
95
+                                onDisplayListener = null;
96
+                            }
97
+                        }
98
+                    });
94 99
                 }
95 100
             });
96 101
         }