Explorar el Código

Send willAppear didAppear for initial screen (#1084)

* Send willAppear didAppear for initial screen

* empty commit
Guy Carmeli hace 7 años
padre
commit
2c893122b8

+ 9
- 0
android/app/src/main/java/com/reactnativenavigation/screens/ScreenStack.java Ver fichero

@@ -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