|
@@ -7,11 +7,9 @@ import android.view.ViewGroup;
|
7
|
7
|
import android.widget.FrameLayout;
|
8
|
8
|
|
9
|
9
|
import com.facebook.react.ReactInstanceManager;
|
10
|
|
-import com.facebook.react.ReactRootView;
|
11
|
10
|
import com.reactnativenavigation.activities.BaseReactActivity;
|
12
|
11
|
import com.reactnativenavigation.core.RctManager;
|
13
|
12
|
import com.reactnativenavigation.core.objects.Screen;
|
14
|
|
-import com.reactnativenavigation.utils.ReflectionUtils;
|
15
|
13
|
|
16
|
14
|
import java.util.Stack;
|
17
|
15
|
|
|
@@ -60,7 +58,7 @@ public class ScreenStack extends FrameLayout {
|
60
|
58
|
if (oldView != null) {
|
61
|
59
|
addView(view, MATCH_PARENT, MATCH_PARENT);
|
62
|
60
|
|
63
|
|
- ReflectionUtils.setBooleanField(oldView.getReactRootView(), "mAttachScheduled", true);
|
|
61
|
+ oldView.onTemporallyRemovedFromScreen();
|
64
|
62
|
getLayoutTransition().setStartDelay(LayoutTransition.DISAPPEARING, DISAPPEAR_ANIMATION_DELAY);
|
65
|
63
|
removeView(oldView);
|
66
|
64
|
getLayoutTransition().setStartDelay(LayoutTransition.DISAPPEARING, 0);
|
|
@@ -78,7 +76,7 @@ public class ScreenStack extends FrameLayout {
|
78
|
76
|
ScreenView popped = mStack.pop();
|
79
|
77
|
addView(mStack.peek().view, 0);
|
80
|
78
|
|
81
|
|
- ReflectionUtils.setBooleanField(popped.view.getReactRootView(), "mAttachScheduled", false);
|
|
79
|
+ popped.view.onRemovedFromScreen();
|
82
|
80
|
removeView(popped.view);
|
83
|
81
|
return popped.screen;
|
84
|
82
|
}
|
|
@@ -91,7 +89,7 @@ public class ScreenStack extends FrameLayout {
|
91
|
89
|
ScreenView oldScreenView = null;
|
92
|
90
|
while (getStackSize() > 1) {
|
93
|
91
|
ScreenView popped = mStack.pop();
|
94
|
|
- ReflectionUtils.setBooleanField(popped.view.getReactRootView(), "mAttachScheduled", false);
|
|
92
|
+ popped.view.onRemovedFromScreen();
|
95
|
93
|
removeView(popped.view);
|
96
|
94
|
if (oldScreenView == null) {
|
97
|
95
|
oldScreenView = popped;
|
|
@@ -116,11 +114,11 @@ public class ScreenStack extends FrameLayout {
|
116
|
114
|
ScreenView oldScreenView = null;
|
117
|
115
|
if (!mStack.isEmpty()) {
|
118
|
116
|
while (getStackSize() > 0) {
|
119
|
|
- ScreenView screenView = mStack.pop();
|
120
|
|
- ReflectionUtils.setBooleanField(screenView.view.getReactRootView(), "mAttachScheduled", false);
|
121
|
|
- removeView(screenView.view);
|
|
117
|
+ ScreenView popped = mStack.pop();
|
|
118
|
+ popped.view.onRemovedFromScreen();
|
|
119
|
+ removeView(popped.view);
|
122
|
120
|
if (oldScreenView == null) {
|
123
|
|
- oldScreenView = screenView;
|
|
121
|
+ oldScreenView = popped;
|
124
|
122
|
}
|
125
|
123
|
}
|
126
|
124
|
}
|
|
@@ -151,8 +149,7 @@ public class ScreenStack extends FrameLayout {
|
151
|
149
|
* Remove the ScreenStack from {@code parent} while preventing all child react views from getting unmounted
|
152
|
150
|
*/
|
153
|
151
|
public void removeFromScreen(ViewGroup parent) {
|
154
|
|
- ReactRootView view = mStack.peek().view.getReactRootView();
|
155
|
|
- ReflectionUtils.setBooleanField(view, "mAttachScheduled", true);
|
|
152
|
+ mStack.peek().view.onTemporallyRemovedFromScreen();
|
156
|
153
|
|
157
|
154
|
parent.removeView(this);
|
158
|
155
|
}
|
|
@@ -161,8 +158,7 @@ public class ScreenStack extends FrameLayout {
|
161
|
158
|
* Add ScreenStack to {@code parent}
|
162
|
159
|
*/
|
163
|
160
|
public void addToScreen(ViewGroup parent) {
|
164
|
|
- ReactRootView view = mStack.peek().view.getReactRootView();
|
165
|
|
- ReflectionUtils.setBooleanField(view, "mAttachScheduled", false);
|
|
161
|
+ mStack.peek().view.onReaddedToScreen();
|
166
|
162
|
|
167
|
163
|
parent.addView(this, new FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
|
168
|
164
|
}
|