|
@@ -5,13 +5,15 @@ import android.view.View;
|
5
|
5
|
import android.widget.FrameLayout;
|
6
|
6
|
|
7
|
7
|
import com.facebook.react.ReactInstanceManager;
|
|
8
|
+import com.facebook.react.ReactRootView;
|
8
|
9
|
import com.reactnativenavigation.activities.BaseReactActivity;
|
9
|
10
|
import com.reactnativenavigation.core.RctManager;
|
10
|
11
|
import com.reactnativenavigation.core.objects.Screen;
|
|
12
|
+import com.reactnativenavigation.utils.ReflectionUtils;
|
11
|
13
|
|
12
|
14
|
import java.util.Stack;
|
13
|
15
|
|
14
|
|
-import static android.view.ViewGroup.LayoutParams.*;
|
|
16
|
+import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
15
|
17
|
|
16
|
18
|
public class ScreenStack extends FrameLayout {
|
17
|
19
|
|
|
@@ -42,8 +44,10 @@ public class ScreenStack extends FrameLayout {
|
42
|
44
|
}
|
43
|
45
|
RctView view = new RctView(reactActivity, mReactInstanceManager, screen);
|
44
|
46
|
addView(view, MATCH_PARENT, MATCH_PARENT);
|
45
|
|
- if(oldView!=null) {
|
46
|
|
- oldView.setVisibility(GONE);
|
|
47
|
+ if(oldView != null) {
|
|
48
|
+ ReactRootView reactRootView = ((RctView) oldView).getReactRootView();
|
|
49
|
+ ReflectionUtils.setBooleanField(reactRootView, "mAttachScheduled", true);
|
|
50
|
+ removeView(oldView);
|
47
|
51
|
}
|
48
|
52
|
stack.push(new ScreenView(screen, view));
|
49
|
53
|
}
|
|
@@ -54,12 +58,7 @@ public class ScreenStack extends FrameLayout {
|
54
|
58
|
}
|
55
|
59
|
ScreenView popped = stack.pop();
|
56
|
60
|
if(!stack.isEmpty()) {
|
57
|
|
- View view = stack.peek().view;
|
58
|
|
- if(view.getParent() == null)
|
59
|
|
- addView(stack.peek().view, 0);
|
60
|
|
- else {
|
61
|
|
- view.setVisibility(VISIBLE);
|
62
|
|
- }
|
|
61
|
+ addView(stack.peek().view, 0);
|
63
|
62
|
}
|
64
|
63
|
removeView(popped.view);
|
65
|
64
|
return popped.screen;
|