|
@@ -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);
|
|
@@ -76,9 +74,12 @@ public class ScreenStack extends FrameLayout {
|
76
|
74
|
}
|
77
|
75
|
|
78
|
76
|
ScreenView popped = mStack.pop();
|
79
|
|
- addView(mStack.peek().view, 0);
|
80
|
77
|
|
81
|
|
- ReflectionUtils.setBooleanField(popped.view.getReactRootView(), "mAttachScheduled", false);
|
|
78
|
+ RctView newView = mStack.peek().view;
|
|
79
|
+ addView(newView);
|
|
80
|
+ newView.onReAddToScreen();
|
|
81
|
+
|
|
82
|
+ popped.view.onRemoveFromScreen();
|
82
|
83
|
removeView(popped.view);
|
83
|
84
|
return popped.screen;
|
84
|
85
|
}
|
|
@@ -91,7 +92,7 @@ public class ScreenStack extends FrameLayout {
|
91
|
92
|
ScreenView oldScreenView = null;
|
92
|
93
|
while (getStackSize() > 1) {
|
93
|
94
|
ScreenView popped = mStack.pop();
|
94
|
|
- ReflectionUtils.setBooleanField(popped.view.getReactRootView(), "mAttachScheduled", false);
|
|
95
|
+ popped.view.onRemoveFromScreen();
|
95
|
96
|
removeView(popped.view);
|
96
|
97
|
if (oldScreenView == null) {
|
97
|
98
|
oldScreenView = popped;
|
|
@@ -116,11 +117,11 @@ public class ScreenStack extends FrameLayout {
|
116
|
117
|
ScreenView oldScreenView = null;
|
117
|
118
|
if (!mStack.isEmpty()) {
|
118
|
119
|
while (getStackSize() > 0) {
|
119
|
|
- ScreenView screenView = mStack.pop();
|
120
|
|
- ReflectionUtils.setBooleanField(screenView.view.getReactRootView(), "mAttachScheduled", false);
|
121
|
|
- removeView(screenView.view);
|
|
120
|
+ ScreenView popped = mStack.pop();
|
|
121
|
+ popped.view.onRemoveFromScreen();
|
|
122
|
+ removeView(popped.view);
|
122
|
123
|
if (oldScreenView == null) {
|
123
|
|
- oldScreenView = screenView;
|
|
124
|
+ oldScreenView = popped;
|
124
|
125
|
}
|
125
|
126
|
}
|
126
|
127
|
}
|
|
@@ -151,8 +152,7 @@ public class ScreenStack extends FrameLayout {
|
151
|
152
|
* Remove the ScreenStack from {@code parent} while preventing all child react views from getting unmounted
|
152
|
153
|
*/
|
153
|
154
|
public void removeFromScreen(ViewGroup parent) {
|
154
|
|
- ReactRootView view = mStack.peek().view.getReactRootView();
|
155
|
|
- ReflectionUtils.setBooleanField(view, "mAttachScheduled", true);
|
|
155
|
+ mStack.peek().view.onTemporallyRemovedFromScreen();
|
156
|
156
|
|
157
|
157
|
parent.removeView(this);
|
158
|
158
|
}
|
|
@@ -161,8 +161,7 @@ public class ScreenStack extends FrameLayout {
|
161
|
161
|
* Add ScreenStack to {@code parent}
|
162
|
162
|
*/
|
163
|
163
|
public void addToScreen(ViewGroup parent) {
|
164
|
|
- ReactRootView view = mStack.peek().view.getReactRootView();
|
165
|
|
- ReflectionUtils.setBooleanField(view, "mAttachScheduled", false);
|
|
164
|
+ mStack.peek().view.onReAddToScreen();
|
166
|
165
|
|
167
|
166
|
parent.addView(this, new FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
|
168
|
167
|
}
|