Преглед на файлове

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