瀏覽代碼

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