hybrid-navigation 2.18.4 → 2.18.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/java/com/reactnative/hybridnavigation/HBDReactRootView.java +4 -54
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactFragment.java +0 -3
- package/ios/HybridNavigation/Navigator/HBDScreenNavigator.m +18 -3
- package/ios/HybridNavigation/ViewController/HBDViewController.m +4 -1
- package/package.json +2 -1
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
package com.reactnative.hybridnavigation;
|
|
2
2
|
|
|
3
|
+
import android.annotation.SuppressLint;
|
|
3
4
|
import android.content.Context;
|
|
4
5
|
import android.os.Bundle;
|
|
5
6
|
import android.util.AttributeSet;
|
|
6
7
|
import android.view.MotionEvent;
|
|
7
|
-
import android.view.ViewTreeObserver;
|
|
8
8
|
|
|
9
9
|
import androidx.annotation.Nullable;
|
|
10
10
|
|
|
11
|
-
import com.facebook.react.ReactInstanceManager;
|
|
12
11
|
import com.facebook.react.ReactRootView;
|
|
13
12
|
|
|
14
|
-
import java.lang.reflect.Method;
|
|
15
|
-
|
|
16
13
|
public class HBDReactRootView extends ReactRootView {
|
|
17
14
|
|
|
18
15
|
protected static final String TAG = "Navigation";
|
|
@@ -35,7 +32,8 @@ public class HBDReactRootView extends ReactRootView {
|
|
|
35
32
|
this.shouldConsumeTouchEvent = consume;
|
|
36
33
|
}
|
|
37
34
|
|
|
38
|
-
@
|
|
35
|
+
@SuppressLint("ClickableViewAccessibility")
|
|
36
|
+
@Override
|
|
39
37
|
public boolean onTouchEvent(MotionEvent ev) {
|
|
40
38
|
int action = ev.getAction() & MotionEvent.ACTION_MASK;
|
|
41
39
|
if (action == MotionEvent.ACTION_DOWN) {
|
|
@@ -44,24 +42,6 @@ public class HBDReactRootView extends ReactRootView {
|
|
|
44
42
|
return shouldConsumeTouchEvent;
|
|
45
43
|
}
|
|
46
44
|
|
|
47
|
-
@Override
|
|
48
|
-
protected void onAttachedToWindow() {
|
|
49
|
-
super.onAttachedToWindow();
|
|
50
|
-
removeOnGlobalLayoutListener();
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
@Override
|
|
54
|
-
protected void onDetachedFromWindow() {
|
|
55
|
-
super.onDetachedFromWindow();
|
|
56
|
-
removeOnGlobalLayoutListener();
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
@Override
|
|
60
|
-
public void startReactApplication(ReactInstanceManager reactInstanceManager, String moduleName, @Nullable Bundle initialProperties) {
|
|
61
|
-
super.startReactApplication(reactInstanceManager, moduleName, initialProperties);
|
|
62
|
-
removeOnGlobalLayoutListener();
|
|
63
|
-
}
|
|
64
|
-
|
|
65
45
|
// 避免 reload 时,重复 run 的问题
|
|
66
46
|
private boolean shouldRunApplication = true;
|
|
67
47
|
|
|
@@ -72,7 +52,7 @@ public class HBDReactRootView extends ReactRootView {
|
|
|
72
52
|
super.runApplication();
|
|
73
53
|
}
|
|
74
54
|
}
|
|
75
|
-
|
|
55
|
+
|
|
76
56
|
private boolean hbd_isAttachedToReactInstance;
|
|
77
57
|
|
|
78
58
|
@Override
|
|
@@ -88,34 +68,4 @@ public class HBDReactRootView extends ReactRootView {
|
|
|
88
68
|
super.setAppProperties(appProperties);
|
|
89
69
|
}
|
|
90
70
|
}
|
|
91
|
-
|
|
92
|
-
@Override
|
|
93
|
-
public void unmountReactApplication() {
|
|
94
|
-
super.unmountReactApplication();
|
|
95
|
-
removeOnGlobalLayoutListener();
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
private ViewTreeObserver.OnGlobalLayoutListener mGlobalLayoutListener;
|
|
99
|
-
|
|
100
|
-
private ViewTreeObserver.OnGlobalLayoutListener getGlobalLayoutListener() {
|
|
101
|
-
if (mGlobalLayoutListener == null) {
|
|
102
|
-
try {
|
|
103
|
-
Method method = ReactRootView.class.getDeclaredMethod("getCustomGlobalLayoutListener");
|
|
104
|
-
method.setAccessible(true);
|
|
105
|
-
mGlobalLayoutListener = (ViewTreeObserver.OnGlobalLayoutListener) method.invoke(this);
|
|
106
|
-
} catch (Exception e) {
|
|
107
|
-
e.printStackTrace();
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
return mGlobalLayoutListener;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
void addOnGlobalLayoutListener() {
|
|
114
|
-
removeOnGlobalLayoutListener();
|
|
115
|
-
getViewTreeObserver().addOnGlobalLayoutListener(getGlobalLayoutListener());
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
void removeOnGlobalLayoutListener() {
|
|
119
|
-
getViewTreeObserver().removeOnGlobalLayoutListener(getGlobalLayoutListener());
|
|
120
|
-
}
|
|
121
71
|
}
|
|
@@ -84,7 +84,6 @@ public class ReactFragment extends HybridFragment implements ReactBridgeManager.
|
|
|
84
84
|
public void onResume() {
|
|
85
85
|
super.onResume();
|
|
86
86
|
if (isViewReady()) {
|
|
87
|
-
reactRootView.addOnGlobalLayoutListener();
|
|
88
87
|
sendViewAppearEvent(true);
|
|
89
88
|
}
|
|
90
89
|
}
|
|
@@ -94,7 +93,6 @@ public class ReactFragment extends HybridFragment implements ReactBridgeManager.
|
|
|
94
93
|
super.onPause();
|
|
95
94
|
if (isViewReady()) {
|
|
96
95
|
sendViewAppearEvent(false);
|
|
97
|
-
reactRootView.removeOnGlobalLayoutListener();
|
|
98
96
|
}
|
|
99
97
|
}
|
|
100
98
|
|
|
@@ -206,7 +204,6 @@ public class ReactFragment extends HybridFragment implements ReactBridgeManager.
|
|
|
206
204
|
|
|
207
205
|
if (isViewReady() && isResumed()) {
|
|
208
206
|
sendViewAppearEvent(true);
|
|
209
|
-
reactRootView.addOnGlobalLayoutListener();
|
|
210
207
|
}
|
|
211
208
|
}
|
|
212
209
|
|
|
@@ -103,7 +103,13 @@
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
- (void)handleDismissWithViewController:(UIViewController *) vc callback:(RCTResponseSenderBlock)callback {
|
|
106
|
-
|
|
106
|
+
BOOL animated = YES;
|
|
107
|
+
if ([vc isKindOfClass:[HBDViewController class]]) {
|
|
108
|
+
HBDViewController *hbdvc = (HBDViewController *)vc;
|
|
109
|
+
animated = hbdvc.animatedTransition;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
[vc dismissViewControllerAnimated:animated completion:^{
|
|
107
113
|
callback(@[NSNull.null, @YES]);
|
|
108
114
|
}];
|
|
109
115
|
}
|
|
@@ -119,9 +125,18 @@
|
|
|
119
125
|
vc.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
|
120
126
|
vc.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
|
|
121
127
|
[vc setRequestCode:requestCode];
|
|
128
|
+
|
|
129
|
+
BOOL animated = YES;
|
|
130
|
+
if ([vc isKindOfClass:[HBDViewController class]]) {
|
|
131
|
+
HBDViewController *hbdvc = (HBDViewController *)vc;
|
|
132
|
+
animated = hbdvc.animatedTransition;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (animated) {
|
|
136
|
+
[[HBDAnimationObserver sharedObserver] beginAnimation];
|
|
137
|
+
}
|
|
122
138
|
|
|
123
|
-
[
|
|
124
|
-
[presenting presentViewController:vc animated:YES completion:^{
|
|
139
|
+
[presenting presentViewController:vc animated:animated completion:^{
|
|
125
140
|
callback(@[NSNull.null, @YES]);
|
|
126
141
|
}];
|
|
127
142
|
}
|
|
@@ -48,6 +48,9 @@
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
self.forceTransparentDialogWindow = [options[@"forceTransparentDialogWindow"] boolValue];
|
|
51
|
+
if (self.forceTransparentDialogWindow) {
|
|
52
|
+
_animatedTransition = NO;
|
|
53
|
+
}
|
|
51
54
|
|
|
52
55
|
[self applyNavigationBarOptions:options];
|
|
53
56
|
[self applyTabBarOptions:options];
|
|
@@ -111,7 +114,7 @@
|
|
|
111
114
|
- (void)willMoveToParentViewController:(UIViewController *)parent {
|
|
112
115
|
if (self.forceScreenLandscape) {
|
|
113
116
|
if (parent) {
|
|
114
|
-
[self setScreenOrientation:UIInterfaceOrientationLandscapeRight usingMask:
|
|
117
|
+
[self setScreenOrientation:UIInterfaceOrientationLandscapeRight usingMask:UIInterfaceOrientationMaskLandscape];
|
|
115
118
|
} else {
|
|
116
119
|
[self setScreenOrientation:UIInterfaceOrientationPortrait usingMask:UIInterfaceOrientationMaskPortrait];
|
|
117
120
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hybrid-navigation",
|
|
3
3
|
"description": "React Native Navigation that supports seamless navigation between Native and React.",
|
|
4
|
-
"version": "2.18.
|
|
4
|
+
"version": "2.18.6",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"typings": "./dist/index.d.ts",
|
|
7
7
|
"react-native": "src/index",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"!android/build",
|
|
16
16
|
"!android/.gradle",
|
|
17
17
|
"!android/.idea",
|
|
18
|
+
"!android/.kotlin",
|
|
18
19
|
"!android/local.properties",
|
|
19
20
|
"!ios/build",
|
|
20
21
|
"!**/__tests__"
|