|
@@ -7,6 +7,10 @@ import android.view.KeyEvent;
|
7
|
7
|
|
8
|
8
|
import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
|
9
|
9
|
import com.reactnativenavigation.NavigationApplication;
|
|
10
|
+import com.reactnativenavigation.events.Event;
|
|
11
|
+import com.reactnativenavigation.events.EventBus;
|
|
12
|
+import com.reactnativenavigation.events.ModalDismissedEvent;
|
|
13
|
+import com.reactnativenavigation.events.Subscriber;
|
10
|
14
|
import com.reactnativenavigation.layouts.BottomTabsLayout;
|
11
|
15
|
import com.reactnativenavigation.layouts.Layout;
|
12
|
16
|
import com.reactnativenavigation.layouts.LayoutFactory;
|
|
@@ -21,7 +25,7 @@ import com.reactnativenavigation.react.RedboxPermission;
|
21
|
25
|
|
22
|
26
|
import java.util.List;
|
23
|
27
|
|
24
|
|
-public class NavigationActivity extends AppCompatActivity implements DefaultHardwareBackBtnHandler, ReactGateway.OnJsDevReloadListener {
|
|
28
|
+public class NavigationActivity extends AppCompatActivity implements DefaultHardwareBackBtnHandler, ReactGateway.OnJsDevReloadListener, Subscriber {
|
25
|
29
|
|
26
|
30
|
/**
|
27
|
31
|
* Although we start multiple activities, we make sure to pass Intent.CLEAR_TASK | Intent.NEW_TASK
|
|
@@ -79,6 +83,7 @@ public class NavigationActivity extends AppCompatActivity implements DefaultHard
|
79
|
83
|
|
80
|
84
|
currentActivity = this;
|
81
|
85
|
NavigationApplication.instance.getReactGateway().onResumeActivity(this, this, this);
|
|
86
|
+ EventBus.instance.register(this);
|
82
|
87
|
}
|
83
|
88
|
|
84
|
89
|
@Override
|
|
@@ -86,6 +91,7 @@ public class NavigationActivity extends AppCompatActivity implements DefaultHard
|
86
|
91
|
super.onPause();
|
87
|
92
|
currentActivity = null;
|
88
|
93
|
NavigationApplication.instance.getReactGateway().onPauseActivity();
|
|
94
|
+ EventBus.instance.unregister(this);
|
89
|
95
|
}
|
90
|
96
|
|
91
|
97
|
@Override
|
|
@@ -249,4 +255,11 @@ public class NavigationActivity extends AppCompatActivity implements DefaultHard
|
249
|
255
|
public void showSnackbar(SnackbarParams params) {
|
250
|
256
|
layout.showSnackbar(params);
|
251
|
257
|
}
|
|
258
|
+
|
|
259
|
+ @Override
|
|
260
|
+ public void onEvent(Event event) {
|
|
261
|
+ if (event.getType() == ModalDismissedEvent.TYPE) {
|
|
262
|
+ layout.onModalDismissed();
|
|
263
|
+ }
|
|
264
|
+ }
|
252
|
265
|
}
|