|
@@ -2,7 +2,6 @@ package com.reactnativenavigation.views;
|
2
|
2
|
|
3
|
3
|
import android.os.Bundle;
|
4
|
4
|
import android.view.ViewTreeObserver;
|
5
|
|
-import android.view.inputmethod.InputMethodManager;
|
6
|
5
|
import android.widget.FrameLayout;
|
7
|
6
|
|
8
|
7
|
import com.facebook.react.ReactInstanceManager;
|
|
@@ -12,8 +11,6 @@ import com.reactnativenavigation.core.objects.Screen;
|
12
|
11
|
import com.reactnativenavigation.utils.BridgeUtils;
|
13
|
12
|
import com.reactnativenavigation.utils.ReflectionUtils;
|
14
|
13
|
|
15
|
|
-import static android.content.Context.INPUT_METHOD_SERVICE;
|
16
|
|
-
|
17
|
14
|
/**
|
18
|
15
|
* Created by guyc on 10/03/16.
|
19
|
16
|
*/
|
|
@@ -28,7 +25,7 @@ public class RctView extends FrameLayout {
|
28
|
25
|
/**
|
29
|
26
|
* This method will be invoked when the {@link ReactRootView} is visible.
|
30
|
27
|
*/
|
31
|
|
- public void onDisplayed();
|
|
28
|
+ void onDisplayed();
|
32
|
29
|
}
|
33
|
30
|
|
34
|
31
|
@SuppressWarnings("unchecked")
|
|
@@ -70,30 +67,23 @@ public class RctView extends FrameLayout {
|
70
|
67
|
*/
|
71
|
68
|
public void onTemporallyRemovedFromScreen() {
|
72
|
69
|
// Hack in order to prevent the react view from getting unmounted
|
73
|
|
- ReflectionUtils.setBooleanField(this, "mAttachScheduled", true);
|
74
|
|
- dismissSoftKeyBoard();
|
|
70
|
+ ReflectionUtils.setBooleanField(mReactRootView, "mAttachScheduled", true);
|
75
|
71
|
}
|
76
|
72
|
|
77
|
73
|
/**
|
78
|
74
|
* Must be called before view is removed from screen inorder to ensure onDetachedFromScreen is properly
|
79
|
75
|
* executed and componentWillUnmount is called
|
80
|
76
|
*/
|
81
|
|
- public void onRemovedFromScreen() {
|
82
|
|
- ReflectionUtils.setBooleanField(this, "mAttachScheduled", false);
|
83
|
|
- dismissSoftKeyBoard();
|
84
|
|
- }
|
85
|
|
-
|
86
|
|
- private void dismissSoftKeyBoard() {
|
87
|
|
- InputMethodManager inputManager = (InputMethodManager) getContext().getSystemService(INPUT_METHOD_SERVICE);
|
88
|
|
- inputManager.hideSoftInputFromWindow(getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
|
|
77
|
+ public void onRemoveFromScreen() {
|
|
78
|
+ ReflectionUtils.setBooleanField(mReactRootView, "mAttachScheduled", false);
|
89
|
79
|
}
|
90
|
80
|
|
91
|
81
|
/**
|
92
|
|
- * Must be called before view is added again to screen inorder to ensure onDetachedFromScreen is properly
|
|
82
|
+ * Must be called when view is added again to screen inorder to ensure onDetachedFromScreen is properly
|
93
|
83
|
* executed and componentWillUnmount is called
|
94
|
84
|
*/
|
95
|
|
- public void onReaddedToScreen() {
|
96
|
|
- ReflectionUtils.setBooleanField(this, "mAttachScheduled", false);
|
|
85
|
+ public void onReAddToScreen() {
|
|
86
|
+ ReflectionUtils.setBooleanField(mReactRootView, "mAttachScheduled", false);
|
97
|
87
|
}
|
98
|
88
|
}
|
99
|
89
|
|