ソースを参照

Send willAppear didAppear for initial screen (#1084)

* Send willAppear didAppear for initial screen

* empty commit
Guy Carmeli 7 年 前
コミット
2c893122b8
共有1 個のファイルを変更した9 個の追加0 個の削除を含む
  1. 9
    0
      android/app/src/main/java/com/reactnativenavigation/screens/ScreenStack.java

+ 9
- 0
android/app/src/main/java/com/reactnativenavigation/screens/ScreenStack.java ファイルの表示

@@ -93,6 +93,15 @@ public class ScreenStack {
93 93
     public void pushInitialScreen(ScreenParams initialScreenParams, LayoutParams params) {
94 94
         Screen initialScreen = ScreenFactory.create(activity, initialScreenParams, leftButtonOnClickListener);
95 95
         initialScreen.setVisibility(View.INVISIBLE);
96
+        initialScreen.setOnDisplayListener(new Screen.OnDisplayListener() {
97
+            @Override
98
+            public void onDisplay() {
99
+                if (isStackVisible) {
100
+                    NavigationApplication.instance.getEventEmitter().sendNavigatorEvent("willAppear", stack.peek().getNavigatorEventId());
101
+                    NavigationApplication.instance.getEventEmitter().sendNavigatorEvent("didAppear", stack.peek().getNavigatorEventId());
102
+                }
103
+            }
104
+        });
96 105
         addScreen(initialScreen, params);
97 106
     }
98 107