|
@@ -2,6 +2,7 @@ package com.reactnativenavigation.screens;
|
2
|
2
|
|
3
|
3
|
import android.support.annotation.Nullable;
|
4
|
4
|
import android.support.v7.app.AppCompatActivity;
|
|
5
|
+import android.util.Log;
|
5
|
6
|
import android.view.View;
|
6
|
7
|
import android.widget.RelativeLayout;
|
7
|
8
|
|
|
@@ -18,6 +19,7 @@ import java.util.List;
|
18
|
19
|
import java.util.Stack;
|
19
|
20
|
|
20
|
21
|
public class ScreenStack {
|
|
22
|
+ private static final String TAG = "ScreenStack";
|
21
|
23
|
|
22
|
24
|
public interface OnScreenPop {
|
23
|
25
|
void onScreenPopAnimationEnd();
|
|
@@ -165,7 +167,16 @@ public class ScreenStack {
|
165
|
167
|
}
|
166
|
168
|
|
167
|
169
|
public boolean canPop() {
|
168
|
|
- return getStackSize() > 1;
|
|
170
|
+ return getStackSize() > 1 && !isPreviousScreenAttachedToWindow();
|
|
171
|
+ }
|
|
172
|
+
|
|
173
|
+ private boolean isPreviousScreenAttachedToWindow() {
|
|
174
|
+ Screen previousScreen = stack.get(stack.size() - 2);
|
|
175
|
+ if (previousScreen.getParent() != null) {
|
|
176
|
+ Log.w(TAG, "Can't pop stack. reason: previous screen is already attached");
|
|
177
|
+ return true;
|
|
178
|
+ }
|
|
179
|
+ return false;
|
169
|
180
|
}
|
170
|
181
|
|
171
|
182
|
public void setScreenTopBarVisible(String screenInstanceId, final boolean visible, final boolean animate) {
|